mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-11-28 08:43:57 +00:00
Prevent lost wakupes in Pacer and ComputerManager
This commit is contained in:
1 parent
aad0090d97
commit
fe5a0aea98
3 files changed
+37
-12
No files matched your search
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user