X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fthread.cpp;h=9f5a13f8624dac701d3827ee0d2beefca76e8cf4;hb=b978eb05dcce5eb874bb45e30af854d332b9738f;hp=d67b9fcdef16ba6f5cd0f40c3bb7bb33078665d6;hpb=c483ffc773c012b49f4ea2f5bd1d788c1f0dc4ac;p=stockfish diff --git a/src/thread.cpp b/src/thread.cpp index d67b9fcd..9f5a13f8 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -230,6 +230,7 @@ void ThreadsManager::wake_up() { for (int i = 0; i < size(); i++) { threads[i]->do_sleep = false; + threads[i]->maxPly = 0; if (!useSleepingThreads) threads[i]->wake_up(); @@ -237,12 +238,13 @@ void ThreadsManager::wake_up() { } -// sleep() is called after the search to ask threads to wait on sleep condition +// sleep() is called after the search to ask all the threads but the main to go +// waiting on a sleep condition. void ThreadsManager::sleep() { - for (int i = 0; i < size(); i++) - threads[i]->do_sleep = true; + for (int i = 1; i < size(); i++) // Main thread will go to sleep by itself + threads[i]->do_sleep = true; // to avoid a race with start_thinking() }