X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=e93c5045578193a5e493e1000e34ae8eb7990518;hp=11dcdb34f13840a1b8ff43a7b08df4273fe972f9;hb=df6cb446eaf21;hpb=44236f4ed9844598e1cb065937c3770a938964b2 diff --git a/src/search.cpp b/src/search.cpp index 11dcdb34..e93c5045 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -277,13 +277,13 @@ void MainThread::search() { // the UCI protocol states that we shouldn't print the best move before the // GUI sends a "stop" or "ponderhit" command. We therefore simply wait here // until the GUI sends one of those commands (which also raises Threads.stop). - if (!Threads.stop && (Limits.ponder || Limits.infinite)) - { - Threads.stopOnPonderhit = true; - wait(Threads.stop); - } + Threads.stopOnPonderhit = true; + + while (!Threads.stop && (Threads.ponder || Limits.infinite)) + {} // Busy wait for a stop or a ponder reset - // Stop the threads if not already stopped + // Stop the threads if not already stopped (also raise the stop if + // "ponderhit" just reset Threads.ponder). Threads.stop = true; // Wait until all threads have finished @@ -341,7 +341,6 @@ void Thread::search() { bestValue = delta = alpha = -VALUE_INFINITE; beta = VALUE_INFINITE; - completedDepth = DEPTH_ZERO; if (mainThread) { @@ -499,7 +498,7 @@ void Thread::search() { { // If we are allowed to ponder do not stop the search now but // keep pondering until the GUI sends "ponderhit" or "stop". - if (Limits.ponder) + if (Threads.ponder) Threads.stopOnPonderhit = true; else Threads.stop = true; @@ -1489,7 +1488,7 @@ moves_loop: // When in check search starts from here } // An engine may not stop pondering until told so by the GUI - if (Limits.ponder) + if (Threads.ponder) return; if ( (Limits.use_time_management() && elapsed > Time.maximum() - 10)