From: Marco Costalba Date: Sun, 17 Oct 2010 08:34:23 +0000 (+0100) Subject: Remove some ifdef from wake_sleeping_thread() X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=472971f8516eb068a3e93473b4d9f5c95e6874d4;p=stockfish Remove some ifdef from wake_sleeping_thread() No functional change. Signed-off-by: Marco Costalba --- diff --git a/src/lock.h b/src/lock.h index 5ad56085..82726517 100644 --- a/src/lock.h +++ b/src/lock.h @@ -34,6 +34,7 @@ typedef pthread_cond_t WaitCondition; # define lock_release(x) pthread_mutex_unlock(x) # define lock_destroy(x) pthread_mutex_destroy(x) # define cond_destroy(x) pthread_cond_destroy(x); +# define cond_signal(x) pthread_cond_signal(x); #else @@ -49,6 +50,7 @@ typedef HANDLE WaitCondition; # define lock_release(x) LeaveCriticalSection(x) # define lock_destroy(x) DeleteCriticalSection(x) # define cond_destroy(x) CloseHandle(*x); +# define cond_signal(x) SetEvent(*x); #endif diff --git a/src/search.cpp b/src/search.cpp index 6cc13c01..b3d54fb0 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -2562,16 +2562,9 @@ split_point_start: // At split points actual search starts from here void ThreadsManager::wake_sleeping_thread(int threadID) { - assert(threadID > 0); - assert(threads[threadID].state == THREAD_AVAILABLE); - -#if !defined(_MSC_VER) - pthread_mutex_lock(&WaitLock); - pthread_cond_signal(&WaitCond[threadID]); - pthread_mutex_unlock(&WaitLock); -#else - SetEvent(WaitCond[threadID]); -#endif + lock_grab(&WaitLock); + cond_signal(&WaitCond[threadID]); + lock_release(&WaitLock); }