]> git.sesse.net Git - stockfish/blobdiff - src/thread.cpp
Fix race while exiting
[stockfish] / src / thread.cpp
index bc0b3fcc3227b3a5c128256eafed6bf0852ad1e4..9bd7498979761942ba0b0e01f315e2c444385c26 100644 (file)
@@ -76,10 +76,14 @@ void TimerThread::idle_loop() {
   while (!do_exit)
   {
       mutex.lock();
-      while (!msec && !do_exit)
+
+      if (!do_exit)
           sleepCondition.wait_for(mutex, msec ? msec : INT_MAX);
+
       mutex.unlock();
-      check_time();
+
+      if (msec)
+          check_time();
   }
 }