mirror of
https://github.com/sockspls/badfish
synced 2025-05-01 17:19:36 +00:00
Simplify start_searching() signature
Retire the "sync" behaviour that now is up to the caller to honour. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
d11a529904
commit
3d0d0237c5
4 changed files with 7 additions and 11 deletions
|
@ -119,6 +119,7 @@ void benchmark(int argc, char* argv[]) {
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Threads.start_searching(pos, limits);
|
Threads.start_searching(pos, limits);
|
||||||
|
Threads.wait_for_search_finished();
|
||||||
nodes += Search::RootPosition.nodes_searched();
|
nodes += Search::RootPosition.nodes_searched();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -424,13 +424,11 @@ void ThreadsManager::wait_for_search_finished() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ThreadsManager::start_searching() is used by UI thread to wake up the main
|
// ThreadsManager::start_searching() wakes up the main thread sleeping in
|
||||||
// thread parked in main_loop() and starting a new search. If async is true
|
// main_loop() so to start a new search, then returns immediately.
|
||||||
// then function returns immediately, otherwise caller is blocked waiting for
|
|
||||||
// the search to finish.
|
|
||||||
|
|
||||||
void ThreadsManager::start_searching(const Position& pos, const LimitsType& limits,
|
void ThreadsManager::start_searching(const Position& pos, const LimitsType& limits,
|
||||||
const std::set<Move>& searchMoves, bool async) {
|
const std::set<Move>& searchMoves) {
|
||||||
wait_for_search_finished();
|
wait_for_search_finished();
|
||||||
|
|
||||||
Signals.stopOnPonderhit = Signals.firstRootMove = false;
|
Signals.stopOnPonderhit = Signals.firstRootMove = false;
|
||||||
|
@ -444,8 +442,5 @@ void ThreadsManager::start_searching(const Position& pos, const LimitsType& limi
|
||||||
if (searchMoves.empty() || searchMoves.count(ml.move()))
|
if (searchMoves.empty() || searchMoves.count(ml.move()))
|
||||||
RootMoves.push_back(RootMove(ml.move()));
|
RootMoves.push_back(RootMove(ml.move()));
|
||||||
|
|
||||||
threads[0]->wake_up(); // Start main thread
|
threads[0]->wake_up();
|
||||||
|
|
||||||
if (!async)
|
|
||||||
wait_for_search_finished();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ public:
|
||||||
void set_timer(int msec);
|
void set_timer(int msec);
|
||||||
void wait_for_search_finished();
|
void wait_for_search_finished();
|
||||||
void start_searching(const Position& pos, const Search::LimitsType& limits,
|
void start_searching(const Position& pos, const Search::LimitsType& limits,
|
||||||
const std::set<Move>& = std::set<Move>(), bool async = false);
|
const std::set<Move>& = std::set<Move>());
|
||||||
|
|
||||||
template <bool Fake>
|
template <bool Fake>
|
||||||
Value split(Position& pos, Search::Stack* ss, Value alpha, Value beta, Value bestValue, Move* bestMove,
|
Value split(Position& pos, Search::Stack* ss, Value alpha, Value beta, Value bestValue, Move* bestMove,
|
||||||
|
|
|
@ -228,7 +228,7 @@ namespace {
|
||||||
limits.time = time[pos.side_to_move()];
|
limits.time = time[pos.side_to_move()];
|
||||||
limits.increment = inc[pos.side_to_move()];
|
limits.increment = inc[pos.side_to_move()];
|
||||||
|
|
||||||
Threads.start_searching(pos, limits, searchMoves, true);
|
Threads.start_searching(pos, limits, searchMoves);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue