1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-07-12 03:59:15 +00:00

Simplify and rename wait_for_stop_or_ponderhit()

Setting stopOnPonderhit is now done by the caller.

No functional change.
This commit is contained in:
Marco Costalba 2013-01-13 14:15:19 +01:00
parent 3b14b17664
commit 89a89eb605
3 changed files with 11 additions and 10 deletions

View file

@ -265,7 +265,10 @@ finalize:
// but if we are pondering or in infinite search, we shouldn't print the best // but if we are pondering or in infinite search, we shouldn't print the best
// move before we are told to do so. // move before we are told to do so.
if (!Signals.stop && (Limits.ponder || Limits.infinite)) 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 // 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()) sync_cout << "bestmove " << move_to_uci(RootMoves[0].pv[0], RootPos.is_chess960())

View file

@ -131,16 +131,14 @@ void Thread::wake_up() {
} }
// Thread::wait_for_stop_or_ponderhit() is called when the maximum depth is // Thread::wait_for_stop() is called when the maximum depth is reached while
// reached while the program is pondering. The point is to work around a wrinkle // the program is pondering. The point is to work around a wrinkle in the UCI
// in the UCI protocol: When pondering, the engine is not allowed to give a // protocol: When pondering, the engine is not allowed to give a "bestmove"
// "bestmove" before the GUI sends it a "stop" or "ponderhit" command. We simply // before the GUI sends it a "stop" or "ponderhit" command. We simply wait here
// wait here until one of these commands (that raise StopRequest) is sent and // 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() { void Thread::wait_for_stop() {
Signals.stopOnPonderhit = true;
mutex.lock(); mutex.lock();
while (!Signals.stop) sleepCondition.wait(mutex); while (!Signals.stop) sleepCondition.wait(mutex);

View file

@ -105,7 +105,7 @@ public:
void idle_loop(); void idle_loop();
void main_loop(); void main_loop();
void timer_loop(); void timer_loop();
void wait_for_stop_or_ponderhit(); void wait_for_stop();
SplitPoint splitPoints[MAX_SPLITPOINTS_PER_THREAD]; SplitPoint splitPoints[MAX_SPLITPOINTS_PER_THREAD];
Material::Table materialTable; Material::Table materialTable;