Fix an hang when max depth is reached
authorMarco Costalba <mcostalba@gmail.com>
Thu, 29 Mar 2012 19:04:27 +0000 (20:04 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Thu, 29 Mar 2012 19:04:27 +0000 (20:04 +0100)
In this case SF stop searching and goes sleeping
waiting for a stop / ponderhit before to return
best move. So when a "stop" arrives we need to wake
up the main thread again.

Another regression introduced by 3aa471f2a9cb,
hopefully the last one.

Thanks to Otello1984 to reporting this.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/thread.cpp

index 6a5454faa9ed5abc0dc07a06ab585cb7b5f0bea8..6fefd58a792b9225d7a121bf102e38e18a8850fc 100644 (file)
@@ -419,6 +419,7 @@ void ThreadsManager::wait_for_search_finished() {
 
   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);
 }