]> git.sesse.net Git - stockfish/blobdiff - src/thread.cpp
Fix a bug in timer loop
[stockfish] / src / thread.cpp
index bc0b3fcc3227b3a5c128256eafed6bf0852ad1e4..5f3b4d314bfb2b6edf27d65dec92b47d6dfafa96 100644 (file)
@@ -76,9 +76,10 @@ void TimerThread::idle_loop() {
   while (!do_exit)
   {
       mutex.lock();
-      while (!msec && !do_exit)
-          sleepCondition.wait_for(mutex, msec ? msec : INT_MAX);
+      do sleepCondition.wait_for(mutex, msec ? msec : INT_MAX);
+      while (!msec && !do_exit); // Don't allow wakeups when msec = 0
       mutex.unlock();
+
       check_time();
   }
 }