mirror of
https://github.com/sockspls/badfish
synced 2025-07-12 03:59:15 +00:00
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:
parent
cd112ee8eb
commit
62b43130e2
1 changed files with 6 additions and 0 deletions
|
@ -1990,7 +1990,10 @@ namespace {
|
||||||
assert(value > -VALUE_INFINITE && value < VALUE_INFINITE);
|
assert(value > -VALUE_INFINITE && value < VALUE_INFINITE);
|
||||||
|
|
||||||
if (thread_should_stop(threadID))
|
if (thread_should_stop(threadID))
|
||||||
|
{
|
||||||
|
lock_grab(&(sp->lock));
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// New best move?
|
// New best move?
|
||||||
if (value > sp->bestValue) // Less then 2% of cases
|
if (value > sp->bestValue) // Less then 2% of cases
|
||||||
|
@ -2124,7 +2127,10 @@ namespace {
|
||||||
assert(value > -VALUE_INFINITE && value < VALUE_INFINITE);
|
assert(value > -VALUE_INFINITE && value < VALUE_INFINITE);
|
||||||
|
|
||||||
if (thread_should_stop(threadID))
|
if (thread_should_stop(threadID))
|
||||||
|
{
|
||||||
|
lock_grab(&(sp->lock));
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// New best move?
|
// New best move?
|
||||||
if (value > sp->bestValue) // Less then 2% of cases
|
if (value > sp->bestValue) // Less then 2% of cases
|
||||||
|
|
Loading…
Add table
Reference in a new issue