mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 09:06:45 +08:00
Introduce and use wait_for_search_finished()
Helper function that allows us to simplify the code. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
12
src/uci.cpp
12
src/uci.cpp
@@ -67,7 +67,10 @@ void uci_loop() {
|
||||
is >> skipws >> token;
|
||||
|
||||
if (token == "quit" || token == "stop")
|
||||
Threads.stop_thinking();
|
||||
{
|
||||
Search::Signals.stop = true;
|
||||
Threads.wait_for_search_finished(); // Cannot quit while threads are running
|
||||
}
|
||||
|
||||
else if (token == "ponderhit")
|
||||
{
|
||||
@@ -77,7 +80,10 @@ void uci_loop() {
|
||||
Search::Limits.ponder = false;
|
||||
|
||||
if (Search::Signals.stopOnPonderhit)
|
||||
Threads.stop_thinking();
|
||||
{
|
||||
Search::Signals.stop = true;
|
||||
Threads.wait_for_search_finished();
|
||||
}
|
||||
}
|
||||
|
||||
else if (token == "go")
|
||||
@@ -223,7 +229,7 @@ namespace {
|
||||
limits.time = time[pos.side_to_move()];
|
||||
limits.increment = inc[pos.side_to_move()];
|
||||
|
||||
Threads.start_thinking(pos, limits, searchMoves, true);
|
||||
Threads.start_searching(pos, limits, searchMoves, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user