1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-01 17:19:36 +00:00

Call wait_for_search_finished() only when quitting

When quitting we should avoid RootPosition to be
destroyed while threads are still running, leading
to a crash. In case of a "stop" or "ponderhit"
command there is no need for the UI thread to wait.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2012-03-26 18:35:23 +01:00
parent 3aa471f2a9
commit d11a529904

View file

@ -69,7 +69,9 @@ void uci_loop() {
if (token == "quit" || token == "stop")
{
Search::Signals.stop = true;
Threads.wait_for_search_finished(); // Cannot quit while threads are running
if (token == "quit") // Cannot quit while threads are still running
Threads.wait_for_search_finished();
}
else if (token == "ponderhit")
@ -80,10 +82,7 @@ void uci_loop() {
Search::Limits.ponder = false;
if (Search::Signals.stopOnPonderhit)
{
Search::Signals.stop = true;
Threads.wait_for_search_finished();
}
}
else if (token == "go")