Commit 50e5c47a authored by Charlie Fenton's avatar Charlie Fenton

Fix Windows thread termination and cleanup.

svn path=/trunk/boinc/; revision=13803
parent 2ff1bc4f
......@@ -239,7 +239,7 @@ int CScreensaver::terminate_screensaver(int& graphics_application, RESULT *worke
if (graphics_application) {
// V6 Graphics
kill_program(graphics_application);
#ifdef __APPLE
#ifdef __APPLE__
// For sandbox security, use gfx_switcher to launch gfx app
// as user boinc_project and group boinc_project.
int retval = 0;
......@@ -331,12 +331,7 @@ void *CScreensaver::DataManagementProc() {
graphics_app_result_ptr = NULL;
previous_result_ptr = NULL;
}
#ifdef _WIN32
TerminateThread(m_hDataManagementThread, 0);
#else
pthread_exit(0); // Exit the thread
#endif
return 0; // Exit the thread
}
boinc_sleep(0.5);
......@@ -368,11 +363,7 @@ void *CScreensaver::DataManagementProc() {
graphics_app_result_ptr = NULL;
previous_result_ptr = NULL;
}
#ifdef _WIN32
TerminateThread(m_hDataManagementThread, 0);
#else
pthread_exit(0); // Exit the thread
#endif
return 0; // Exit the thread
}
boinc_sleep(0.25);
......
......@@ -181,20 +181,20 @@ CScreensaver::CScreensaver() {
LoadString(NULL, IDS_DESCRIPTION, m_strWindowTitle, 200);
m_bPaintingInitialized = FALSE;
m_bPaintingInitialized = FALSE;
m_dwBlankScreen = 0;
m_dwBlankTime = 0;
rpc = 0;
rpc = NULL;
m_hDataManagementThread = NULL;
m_hGraphicsApplication = NULL;
m_bResetCoreState = TRUE;
m_QuitDataManagementProc = FALSE;
m_QuitDataManagementProc = FALSE;
m_bBOINCConfigChecked = FALSE;
m_bBOINCStartupConfigured = FALSE;
memset(&m_running_result, 0, sizeof(m_running_result));
ZeroMemory(m_Monitors, sizeof(m_Monitors));
ZeroMemory(m_Monitors, sizeof(m_Monitors));
m_dwNumMonitors = 0;
m_dwLastInputTimeAtStartup = 0;
......@@ -329,9 +329,14 @@ INT CScreensaver::Run() {
// Create the data management thread to talk with the daemon
//
if (!DestoryDataManagementThread()) {
if (!DestroyDataManagementThread()) {
return E_FAIL;
}
if (rpc) {
delete rpc;
rpc = NULL;
}
break;
case sm_passwordchange:
......@@ -1001,7 +1006,7 @@ BOOL CScreensaver::CreateDataManagementThread() {
// Terminate the thread that is used to talk to the daemon.
//
BOOL CScreensaver::DestoryDataManagementThread() {
BOOL CScreensaver::DestroyDataManagementThread() {
m_QuitDataManagementProc = TRUE; // Tell RPC Thread to exit
// Wait up to 5 seconds for DataManagementThread to exit
......@@ -1010,7 +1015,7 @@ BOOL CScreensaver::DestoryDataManagementThread() {
BOOL bRetVal = FALSE;
bRetVal = GetExitCodeThread(m_hDataManagementThread, &dwStatus);
BOINCTRACE(_T("CScreensaver::DestoryDataManagementThread - GetExitCodeThread RetVal = '%d', Status = '%d'\n"), bRetVal, dwStatus);
BOINCTRACE(_T("CScreensaver::DestroyDataManagementThread - GetExitCodeThread RetVal = '%d', Status = '%d'\n"), bRetVal, dwStatus);
if (bRetVal && (dwStatus != STILL_ACTIVE)) {
break;
}
......
......@@ -154,7 +154,7 @@ protected:
//
protected:
BOOL CreateDataManagementThread();
BOOL DestoryDataManagementThread();
BOOL DestroyDataManagementThread();
DWORD WINAPI DataManagementProc();
static DWORD WINAPI DataManagementProcStub( LPVOID lpParam );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment