]> git.sesse.net Git - stockfish/commitdiff
Remove some ifdef from wake_sleeping_thread()
authorMarco Costalba <mcostalba@gmail.com>
Sun, 17 Oct 2010 08:34:23 +0000 (09:34 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 17 Oct 2010 08:35:44 +0000 (09:35 +0100)
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/lock.h
src/search.cpp

index 5ad56085e997a07e592a177b0b59f24b47074c8c..82726517317764f77abbf5a68020f53e043c45aa 100644 (file)
@@ -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
 
index 6cc13c01fcf643f545cac9e647e7565f6a3e6ca2..b3d54fb0c71328b8ca337c485589088106358683 100644 (file)
@@ -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);
   }