From 7ece32d0b23a554a19e324d87e3705d2591d58e0 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Mon, 15 Jun 2009 22:43:08 +0000 Subject: [PATCH] MGR: If LOCKFILE doesn't already exist, core client isn't running so skip further testing svn path=/branches/boinc_core_release_6_8/; revision=18423 --- checkin_notes | 9 +++++++++ clientgui/BOINCClientManager.cpp | 10 ++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/checkin_notes b/checkin_notes index e7f5b4f19c..f35c0652b9 100644 --- a/checkin_notes +++ b/checkin_notes @@ -5692,3 +5692,12 @@ Rom 15 June 2009 ptp_boinc_cli.vcproj ptp_boincmgr.vcproj sim.vcproj + + +Charlie 15 June 2009 + - MGR: If LOCKFILE doesn't already exist, core client isn't running so skip + further testing. This avoids a very rare possible race condition and is + more efficient. + + clientgui/ + BOINCClientManager.cpp diff --git a/clientgui/BOINCClientManager.cpp b/clientgui/BOINCClientManager.cpp index 1beed6749f..133e7ed957 100644 --- a/clientgui/BOINCClientManager.cpp +++ b/clientgui/BOINCClientManager.cpp @@ -144,10 +144,12 @@ bool CBOINCClientManager::IsBOINCCoreRunning() { static FILE_LOCK file_lock; sprintf(path, "%s/%s", (char *)wxGetApp().GetDataDirectory().char_str(), LOCK_FILE_NAME); - if (file_lock.lock(path)) { - running = true; - } else { - file_lock.unlock(path); + if (boinc_file_exists(path)) { // If there is no lock file, core is not running + if (file_lock.lock(path)) { + running = true; + } else { + file_lock.unlock(path); + } } #endif wxLogTrace(wxT("Function Status"), wxT("CBOINCClientManager::IsBOINCCoreRunning - Returning '%d'"), (int)running);