X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fthread.cpp;h=c602e0b46a873a60ae6a02d117d8d70347206829;hb=bdeda52efd55c97d0f5da908267c01f973371e5d;hp=0b851d6a6e0b5f0f48d5535aea3a06cd5c4d909d;hpb=5410424e3d036b43715c7989aa99e449cdcde18e;p=stockfish diff --git a/src/thread.cpp b/src/thread.cpp index 0b851d6a..c602e0b4 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -68,24 +68,12 @@ void Thread::wait_for_search_finished() { } -/// Thread::wait() waits on sleep condition until condition is true - -void Thread::wait(std::atomic_bool& condition) { - - std::unique_lock lk(mutex); - sleepCondition.wait(lk, [&]{ return bool(condition); }); -} - - /// Thread::start_searching() wakes up the thread that will start the search -void Thread::start_searching(bool resume) { +void Thread::start_searching() { std::unique_lock lk(mutex); - - if (!resume) - searching = true; - + searching = true; sleepCondition.notify_one(); } @@ -183,11 +171,12 @@ uint64_t ThreadPool::tb_hits() const { /// and starts a new search, then returns immediately. void ThreadPool::start_thinking(Position& pos, StateListPtr& states, - const Search::LimitsType& limits) { + const Search::LimitsType& limits, bool ponderMode) { main()->wait_for_search_finished(); - ponder = stopOnPonderhit = stop = false; + stopOnPonderhit = stop = false; + ponder = ponderMode; Search::Limits = limits; Search::RootMoves rootMoves;