]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Fix race while exiting
[stockfish] / src / search.cpp
index 4eaf2e5ee07c2caea5ce159be013a68a6451d94c..d86f249365f8ed318f70359541fff404862f8cf2 100644 (file)
@@ -1588,7 +1588,7 @@ void Thread::idle_loop() {
           // particular we need to avoid a deadlock in case a master thread has,
           // in the meanwhile, allocated us and sent the wake_up() call before we
           // had the chance to grab the lock.
           // particular we need to avoid a deadlock in case a master thread has,
           // in the meanwhile, allocated us and sent the wake_up() call before we
           // had the chance to grab the lock.
-          if (!is_searching && Threads.sleepWhileIdle)
+          if (!is_searching && !do_exit)
               sleepCondition.wait(mutex);
 
           mutex.unlock();
               sleepCondition.wait(mutex);
 
           mutex.unlock();