MGR: Every 10 seconds, kill any running graphics apps whose associated worker tasks are no longer running

svn path=/trunk/boinc/; revision=13620
This commit is contained in:
Charlie Fenton 2007-09-21 11:45:57 +00:00
parent 683a8bad08
commit 0b8b6d922f
2 changed files with 15 additions and 2 deletions

View File

@ -29,6 +29,7 @@
#include "BOINCGUIApp.h"
#include "BOINCBaseFrame.h"
#include "MainDocument.h"
#include <sys/wait.h>
#ifdef SANDBOX
#include <grp.h>
@ -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<RUNNING_GFX_APP>::iterator gfx_app_iter;

View File

@ -186,6 +186,7 @@ public:
private:
int CachedResultsStatusUpdate();
wxDateTime m_dtResultsTimestamp;
wxDateTime m_dtKillInactiveGfxTimestamp;
std::vector<RUNNING_GFX_APP> m_running_gfx_apps;
RUNNING_GFX_APP* GetRunningGraphicsApp(RESULT* result, int slot);
void KillAllRunningGraphicsApps();