Be sure we exit while loop with lock held

This fixes an hang introduced by recent locking
rewrite patch.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba
2010-01-27 19:23:16 +01:00
parent cd112ee8eb
commit 62b43130e2

View File

@@ -1990,7 +1990,10 @@ namespace {
assert(value > -VALUE_INFINITE && value < VALUE_INFINITE);
if (thread_should_stop(threadID))
{
lock_grab(&(sp->lock));
break;
}
// New best move?
if (value > sp->bestValue) // Less then 2% of cases
@@ -2124,7 +2127,10 @@ namespace {
assert(value > -VALUE_INFINITE && value < VALUE_INFINITE);
if (thread_should_stop(threadID))
{
lock_grab(&(sp->lock));
break;
}
// New best move?
if (value > sp->bestValue) // Less then 2% of cases