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-06-06 19:15:26 -05:00 committed by refractionpcsx2
parent 0f917c24a5
commit 4116aed738
1 changed files with 5 additions and 3 deletions

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();
}