Revert "Call wait_for_search_finished() only when quitting"
authorMarco Costalba <mcostalba@gmail.com>
Fri, 30 Mar 2012 10:44:31 +0000 (12:44 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Fri, 30 Mar 2012 17:58:58 +0000 (18:58 +0100)
We need to wake up main thread if it is sleeping
waiting for stop or ponderhit, so we cannot skip
calling wait_for_search_finished().

Found by Othello1984.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/uci.cpp

index c3eb9190b4f2b5809c4642c827bb2bcd83873d14..fc02cf60f69a20eec8cbb034b438865b9ab6d5f0 100644 (file)
@@ -69,9 +69,7 @@ void uci_loop() {
       if (token == "quit" || token == "stop")
       {
           Search::Signals.stop = true;
-
-          if (token == "quit") // Cannot quit while threads are still running
-              Threads.wait_for_search_finished();
+          Threads.wait_for_search_finished(); // Cannot quit while threads are running
       }
 
       else if (token == "ponderhit")
@@ -82,7 +80,10 @@ void uci_loop() {
           Search::Limits.ponder = false;
 
           if (Search::Signals.stopOnPonderhit)
+          {
               Search::Signals.stop = true;
+              Threads.wait_for_search_finished(); // Wake up if is sleeping
+          }
       }
 
       else if (token == "go")