Use only one ConditionVariable to sync UI

To sync UI with main thread it is enough a single
condition variable because here we have a single
producer / single consumer design pattern.

Two condition variables are strictly needed just for
many producers / many consumers case.

Note that this is possible because now we don't send to
sleep idle threads anymore while searching, so that now
only UI can wake up the main thread and we can use the
same ConditionVariable for both threads.

The natural consequence is to retire wait_for_think_finished()
and move all the logic under MainThread class, yielding the
rename of teh function to join()

No functional change.
This commit is contained in:
Marco Costalba
2015-03-20 17:58:43 +01:00
parent 35b6079852
commit 26dabb1e6b
4 changed files with 14 additions and 15 deletions

View File

@@ -158,7 +158,7 @@ void benchmark(const Position& current, istream& is) {
else
{
Threads.start_thinking(pos, limits, st);
Threads.wait_for_think_finished();
Threads.main()->join();
nodes += Search::RootPos.nodes_searched();
}
}