void Thread::wake_up() {
lock_grab(sleepLock);
- do_sleep = false;
cond_signal(sleepCond);
lock_release(sleepLock);
}
for (int i = 0; i < size(); i++)
{
threads[i]->maxPly = 0;
+ threads[i]->do_sleep = false;
if (!useSleepingThreads)
threads[i]->wake_up();
Thread* main = threads[0];
lock_grab(main->sleepLock);
+ cond_signal(main->sleepCond); // In case is waiting for stop or ponderhit
while (!main->do_sleep) cond_wait(sleepCond, main->sleepLock);
lock_release(main->sleepLock);
}
const std::set<Move>& searchMoves) {
wait_for_search_finished();
+ SearchTime.restart(); // As early as possible
+
Signals.stopOnPonderhit = Signals.firstRootMove = false;
Signals.stop = Signals.failedLowAtRoot = false;
if (searchMoves.empty() || searchMoves.count(ml.move()))
RootMoves.push_back(RootMove(ml.move()));
+ threads[0]->do_sleep = false;
threads[0]->wake_up();
}