mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 08:36:33 +08:00
Set do_sleep out of lock protection
Fixes a not so rare crash (once every 100 games) newly introduced. Unfortunatly I am still not able to figure out why :-( Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -137,7 +137,6 @@ void Thread::main_loop() {
|
|||||||
void Thread::wake_up() {
|
void Thread::wake_up() {
|
||||||
|
|
||||||
lock_grab(sleepLock);
|
lock_grab(sleepLock);
|
||||||
do_sleep = false;
|
|
||||||
cond_signal(sleepCond);
|
cond_signal(sleepCond);
|
||||||
lock_release(sleepLock);
|
lock_release(sleepLock);
|
||||||
}
|
}
|
||||||
@@ -257,6 +256,7 @@ void ThreadsManager::wake_up() const {
|
|||||||
for (int i = 0; i < size(); i++)
|
for (int i = 0; i < size(); i++)
|
||||||
{
|
{
|
||||||
threads[i]->maxPly = 0;
|
threads[i]->maxPly = 0;
|
||||||
|
threads[i]->do_sleep = false;
|
||||||
|
|
||||||
if (!useSleepingThreads)
|
if (!useSleepingThreads)
|
||||||
threads[i]->wake_up();
|
threads[i]->wake_up();
|
||||||
@@ -442,5 +442,6 @@ void ThreadsManager::start_searching(const Position& pos, const LimitsType& limi
|
|||||||
if (searchMoves.empty() || searchMoves.count(ml.move()))
|
if (searchMoves.empty() || searchMoves.count(ml.move()))
|
||||||
RootMoves.push_back(RootMove(ml.move()));
|
RootMoves.push_back(RootMove(ml.move()));
|
||||||
|
|
||||||
|
threads[0]->do_sleep = false;
|
||||||
threads[0]->wake_up();
|
threads[0]->wake_up();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user