]> git.sesse.net Git - stockfish/commitdiff
Simplify and rename wait_for_stop_or_ponderhit()
authorMarco Costalba <mcostalba@gmail.com>
Sun, 13 Jan 2013 13:15:19 +0000 (14:15 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 13 Jan 2013 13:15:19 +0000 (14:15 +0100)
Setting stopOnPonderhit is now done by the caller.

No functional change.

src/search.cpp
src/thread.cpp
src/thread.h

index b3f66c6a8001f79845ab783df4206d5a0f803071..1371d1b9ee4085c70b89185520f48c5f525f7b9f 100644 (file)
@@ -265,7 +265,10 @@ finalize:
   // but if we are pondering or in infinite search, we shouldn't print the best
   // move before we are told to do so.
   if (!Signals.stop && (Limits.ponder || Limits.infinite))
   // but if we are pondering or in infinite search, we shouldn't print the best
   // move before we are told to do so.
   if (!Signals.stop && (Limits.ponder || Limits.infinite))
-      RootPos.this_thread()->wait_for_stop_or_ponderhit();
+  {
+      Signals.stopOnPonderhit = true;
+      RootPos.this_thread()->wait_for_stop();
+  }
 
   // Best move could be MOVE_NONE when searching on a stalemate position
   sync_cout << "bestmove " << move_to_uci(RootMoves[0].pv[0], RootPos.is_chess960())
 
   // Best move could be MOVE_NONE when searching on a stalemate position
   sync_cout << "bestmove " << move_to_uci(RootMoves[0].pv[0], RootPos.is_chess960())
index b599960528a00d2e67c0948d9a93146a04e14023..180869c6191d0d909d131fe2a8d5e1cc59f1c821 100644 (file)
@@ -131,16 +131,14 @@ 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.
 
 // 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);
 
   mutex.lock();
   while (!Signals.stop) sleepCondition.wait(mutex);
index 2d8a675b4a76ad1eb18bdefc13659814330b9217..92be3a22985572303fae5c669386daf25a6919a8 100644 (file)
@@ -105,7 +105,7 @@ public:
   void idle_loop();
   void main_loop();
   void timer_loop();
   void idle_loop();
   void main_loop();
   void timer_loop();
-  void wait_for_stop_or_ponderhit();
+  void wait_for_stop();
 
   SplitPoint splitPoints[MAX_SPLITPOINTS_PER_THREAD];
   Material::Table materialTable;
 
   SplitPoint splitPoints[MAX_SPLITPOINTS_PER_THREAD];
   Material::Table materialTable;