X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fthread.cpp;h=d9fa9c512c53cc1a5919ebdf2926035876b793a3;hb=831f91b859c43a5fa895ef0c955516ec8b7a8212;hp=ce2f41f2ffeae29008890a7917fdc3302807d827;hpb=cbd7ce468c97ac74efcd497e5196f011b5a646c9;p=stockfish diff --git a/src/thread.cpp b/src/thread.cpp index ce2f41f2..d9fa9c51 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -196,9 +196,9 @@ void ThreadPool::init() { } -// d'tor cleanly terminates the threads when the program exits. +// exit() cleanly terminates the threads before the program exits. -ThreadPool::~ThreadPool() { +void ThreadPool::exit() { for (size_t i = 0; i < threads.size(); i++) delete threads[i]; @@ -414,16 +414,17 @@ void ThreadPool::wait_for_search_finished() { // a new search, then returns immediately. void ThreadPool::start_searching(const Position& pos, const LimitsType& limits, - const std::vector& searchMoves) { + const std::vector& searchMoves, StateStackPtr& states) { wait_for_search_finished(); - SearchTime.restart(); // As early as possible + SearchTime = Time::current_time(); // As early as possible Signals.stopOnPonderhit = Signals.firstRootMove = false; Signals.stop = Signals.failedLowAtRoot = false; RootPosition = pos; Limits = limits; + SetupStates = states; // Ownership transfer here RootMoves.clear(); for (MoveList ml(pos); !ml.end(); ++ml)