Take locks before signaling thread condition variables (#2636)

This commit is contained in:
mwilsnd
2024-07-19 16:11:13 -04:00
committed by GitHub
parent fcc57b6088
commit d15de92158
3 changed files with 5 additions and 2 deletions

View File

@@ -130,6 +130,8 @@ void ThreadedSchedulerBase::schedule(const util::SimpleIdentity tag, std::functi
taskCount++;
}
// Take the worker lock before notifying to prevent threads from waiting while we try to wake them
std::lock_guard<std::mutex> workerLock(workerMutex);
cvAvailable.notify_one();
}