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

@@ -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.
void Thread::wait_for_stop_or_ponderhit() {
Signals.stopOnPonderhit = true;
void Thread::wait_for_stop() {
mutex.lock();
while (!Signals.stop) sleepCondition.wait(mutex);