mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-18 16:16:23 +08:00
Don't reparent if a cutoff is pending
And update master->splitPointsCnt under lock protection. Not stricly necessary because single_bit() condition takes care of false positives anyhow, but it is a bit tricky and moving under lock is the most natural thing to do to avoid races with "reparenting". No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -313,7 +313,7 @@ Value ThreadsManager::split(Position& pos, Stack* ss, Value alpha, Value beta,
|
||||
return bestValue;
|
||||
|
||||
// Pick the next available split point from the split point stack
|
||||
SplitPoint* sp = &master->splitPoints[master->splitPointsCnt++];
|
||||
SplitPoint* sp = &master->splitPoints[master->splitPointsCnt];
|
||||
|
||||
sp->parent = master->curSplitPoint;
|
||||
sp->master = master;
|
||||
@@ -362,6 +362,8 @@ Value ThreadsManager::split(Position& pos, Stack* ss, Value alpha, Value beta,
|
||||
}
|
||||
}
|
||||
|
||||
master->splitPointsCnt++;
|
||||
|
||||
lock_release(splitLock);
|
||||
lock_release(sp->lock);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user