mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 17:16:33 +08: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:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user