Skip to content

Commit

Permalink
Delay waiting for threads to finish
Browse files Browse the repository at this point in the history
Wait after best move is sentm so that
waiting time is not accounted.

No functional change.
  • Loading branch information
mcostalba committed Oct 10, 2015
1 parent e10c4d7 commit 35e649d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,6 @@ void MainThread::think() {
// Stop the threads and the timer
Signals.stop = true;
Threads.timer->run = false;

// Wait until all threads have finished
for (Thread* th : Threads)
if (th != this)
th->wait_while(th->searching);
}

// When playing in 'nodes as time' mode, subtract the searched nodes from
Expand All @@ -335,6 +330,12 @@ void MainThread::think() {
std::cout << " ponder " << UCI::move(rootMoves[0].pv[1], pos.is_chess960());

std::cout << sync_endl;

// Wait until all threads have finished before returning. Best move is already
// sent, so this waiting time is not accounted.
for (Thread* th : Threads)
if (th != this)
th->wait_while(th->searching);
}


Expand Down

0 comments on commit 35e649d

Please sign in to comment.