Prevent lost wakupes in Pacer and ComputerManager

This commit is contained in:
Cameron Gutman committed 2026-11-12 20:40:31 -06:00
1 parent aad0090d97
commit fe5a0aea98
3 files changed
+37 -12

No files matched your search

+7 -3
View File
@@ -205,9 +205,13 @@ ComputerManager::~ComputerManager()
// Stop the delayed flush thread before acquiring the lock in write mode
// to avoid deadlocking with a flush that needs the lock in read mode.
{
// Wake the delayed flush thread
m_DelayedFlushThread->requestInterruption();
m_DelayedFlushCondition.wakeOne();
// Acquire the delayed flush mutex before requesting interruption and
// waking the thread so we cannot race with its predicate check and wait().
{
QMutexLocker locker(&m_DelayedFlushMutex);
m_DelayedFlushThread->requestInterruption();
m_DelayedFlushCondition.wakeOne();
}
// Wait for it to terminate (and finish any pending flush)
m_DelayedFlushThread->wait();