Re-apply the fix for Limits::ponder race

But this time correctly set Threads.ponder

We avoid using 'limits' for passing pondering
flag because we don't want to have 2 ponder
variables in search scope: Search::Limits.ponder
and Threads.ponder. This would be confusing also
because limits.ponder is set at the beginning of
the search and never changes, instead Threads.ponder
can change value asynchronously during search.

No functional change.
This commit is contained in:
Marco Costalba
2017-08-10 12:32:50 -07:00
parent 44236f4ed9
commit 66c5eaebd8
5 changed files with 19 additions and 18 deletions

View File

@@ -277,7 +277,7 @@ void MainThread::search() {
// the UCI protocol states that we shouldn't print the best move before the
// GUI sends a "stop" or "ponderhit" command. We therefore simply wait here
// until the GUI sends one of those commands (which also raises Threads.stop).
if (!Threads.stop && (Limits.ponder || Limits.infinite))
if (!Threads.stop && (Threads.ponder || Limits.infinite))
{
Threads.stopOnPonderhit = true;
wait(Threads.stop);
@@ -499,7 +499,7 @@ void Thread::search() {
{
// If we are allowed to ponder do not stop the search now but
// keep pondering until the GUI sends "ponderhit" or "stop".
if (Limits.ponder)
if (Threads.ponder)
Threads.stopOnPonderhit = true;
else
Threads.stop = true;
@@ -1489,7 +1489,7 @@ moves_loop: // When in check search starts from here
}
// An engine may not stop pondering until told so by the GUI
if (Limits.ponder)
if (Threads.ponder)
return;
if ( (Limits.use_time_management() && elapsed > Time.maximum() - 10)