Async 'stop' command

Don't wait for the search to finish after a 'stop'
command, but keep processing the GUI input if any.

Also explicitly wake up the main thread (that could be
sleeping) after a 'stop' or 'quit' command and do not
rely on wait_for_search_finished() doing it for us.

This patch cleans up the code and functions's definitions,
but it is risky and needs a good test under different
conditions to be sure it does not introduces hungs up.

No functional change.
This commit is contained in:
Marco Costalba
2013-01-06 12:49:01 +01:00
parent edce2a8448
commit e1191b35e8
2 changed files with 9 additions and 20 deletions

View File

@@ -404,7 +404,6 @@ void ThreadPool::wait_for_search_finished() {
Thread* t = main_thread();
t->mutex.lock();
t->sleepCondition.notify_one(); // In case is waiting for stop or ponderhit
while (!t->do_sleep) sleepCondition.wait(t->mutex);
t->mutex.unlock();
}