]> git.sesse.net Git - stockfish/blobdiff - src/thread.cpp
Simplify and rename wait_for_stop_or_ponderhit()
[stockfish] / src / thread.cpp
index 901a20b2bed1d67d1301aa8646d46fd2bdf50c80..180869c6191d0d909d131fe2a8d5e1cc59f1c821 100644 (file)
@@ -131,19 +131,17 @@ void Thread::wake_up() {
 }
 
 
-// Thread::wait_for_stop_or_ponderhit() is called when the maximum depth is
-// reached while the program is pondering. The point is to work around a wrinkle
-// in the UCI protocol: When pondering, the engine is not allowed to give a
-// "bestmove" before the GUI sends it a "stop" or "ponderhit" command. We simply
-// wait here until one of these commands (that raise StopRequest) is sent and
+// Thread::wait_for_stop() is called when the maximum depth is reached while
+// the program is pondering. The point is to work around a wrinkle in the UCI
+// protocol: When pondering, the engine is not allowed to give a "bestmove"
+// before the GUI sends it a "stop" or "ponderhit" command. We simply wait here
+// until one of these commands (that raise Signals.stop) is sent and
 // then return, after which the bestmove and pondermove will be printed.
 
-void Thread::wait_for_stop_or_ponderhit() {
-
-  Signals.stopOnPonderhit = true;
+void Thread::wait_for_stop() {
 
   mutex.lock();
-  while (!Signals.stop) sleepCondition.wait(mutex);;
+  while (!Signals.stop) sleepCondition.wait(mutex);
   mutex.unlock();
 }
 
@@ -404,7 +402,6 @@ void ThreadPool::wait_for_search_finished() {
 
   Thread* t = main_thread();
   t->mutex.lock();
-  t->sleepCondition.notify_one(); // In case is waiting for stop or ponderhit
   while (!t->do_sleep) sleepCondition.wait(t->mutex);
   t->mutex.unlock();
 }