MTGS: Only pause when the queue is empty

Prevents other threads from freezing waiting for the queue to empty when it never will
This commit is contained in:
TellowKrinkle
2021-07-05 10:25:28 +01:00
committed by refractionpcsx2
parent 0f917c24a5
commit 4116aed738
+5 -3
View File
@@ -486,9 +486,9 @@ void SysMtgsThread::ExecuteTaskInThread()
if (m_VsyncSignalListener.exchange(false))
m_sem_Vsync.Post();
busy.Release();
StateCheckInThread();
busy.Acquire();
// Do not StateCheckInThread() here
// Otherwise we could pause while there's still data in the queue
// Which could make the MTVU thread wait forever for it to empty
}
break;
@@ -619,6 +619,8 @@ void SysMtgsThread::OnResumeInThread(bool isSuspended)
void SysMtgsThread::OnCleanupInThread()
{
CloseGS();
// Unblock any threads in WaitGS in case MTGS gets cancelled while still processing work
m_ReadPos.store(m_WritePos.load(std::memory_order_acquire), std::memory_order_relaxed);
_parent::OnCleanupInThread();
}