From 0b8b6d922f4534d3a1f99c9a522deaeb2a5283b8 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Fri, 21 Sep 2007 11:45:57 +0000 Subject: [PATCH] MGR: Every 10 seconds, kill any running graphics apps whose associated worker tasks are no longer running svn path=/trunk/boinc/; revision=13620 --- clientgui/MainDocument.cpp | 16 ++++++++++++++-- clientgui/MainDocument.h | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/clientgui/MainDocument.cpp b/clientgui/MainDocument.cpp index 9d125abc60..13ead4dc48 100644 --- a/clientgui/MainDocument.cpp +++ b/clientgui/MainDocument.cpp @@ -29,6 +29,7 @@ #include "BOINCGUIApp.h" #include "BOINCBaseFrame.h" #include "MainDocument.h" +#include #ifdef SANDBOX #include @@ -397,6 +398,16 @@ int CMainDocument::OnPoll() { m_pNetworkConnection->Poll(); } + // Every 10 seconds, kill any running graphics apps + // whose associated worker tasks are no longer running + wxDateTime timeNow = wxDateTime::Now(); + wxTimeSpan ts(timeNow - m_dtKillInactiveGfxTimestamp); + if (ts.GetSeconds() > 10) { + CachedResultsStatusUpdate(); + m_dtKillInactiveGfxTimestamp = timeNow; + KillInactiveGraphicsApps(); + } + return iRetVal; } @@ -981,8 +992,8 @@ int CMainDocument::WorkResume(std::string& strProjectURL, std::string& strName) } -// If the graphics application for the current task is already running, -// return a pointer to its RUNNING_GFX_APP struct. +// If the graphics application for the current task is already +// running, return a pointer to its RUNNING_GFX_APP struct. RUNNING_GFX_APP* CMainDocument::GetRunningGraphicsApp(RESULT* result, int slot) { bool exited = false; @@ -1026,6 +1037,7 @@ RUNNING_GFX_APP* CMainDocument::GetRunningGraphicsApp(RESULT* result, int slot) } +// Kill any running graphics apps whose worker tasks aren't running void CMainDocument::KillInactiveGraphicsApps() { std::vector::iterator gfx_app_iter; diff --git a/clientgui/MainDocument.h b/clientgui/MainDocument.h index 0f7f64aca4..6b77b34f44 100644 --- a/clientgui/MainDocument.h +++ b/clientgui/MainDocument.h @@ -186,6 +186,7 @@ public: private: int CachedResultsStatusUpdate(); wxDateTime m_dtResultsTimestamp; + wxDateTime m_dtKillInactiveGfxTimestamp; std::vector m_running_gfx_apps; RUNNING_GFX_APP* GetRunningGraphicsApp(RESULT* result, int slot); void KillAllRunningGraphicsApps();