Skip to content

Commit

Permalink
MTGS: avoid a potential very rare deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
gregory38 committed Jul 14, 2016
1 parent 4cdf05e commit 3b4c357
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pcsx2/MTGS.cpp
Expand Up @@ -158,6 +158,13 @@ void SysMtgsThread::PostVsyncStart()

m_VsyncSignalListener.store(true, std::memory_order_release);
//Console.WriteLn( Color_Blue, "(EEcore Sleep) Vsync\t\tringpos=0x%06x, writepos=0x%06x", m_ReadPos.load(), m_WritePos.load() );

// We will wait a vsync event from the MTGS ring. If the ring is already purged, the event will never come !
// To avoid this potential deadlock, ring must be wake up after m_VsyncSignalListener
// Note: potentially we can also miss the previous wake up if we optimize away the post just before the release of busy signal of the ring
// So let's ensure the ring doesn't sleep
m_sem_event.Post();

m_sem_Vsync.WaitNoCancel();
}

Expand Down

0 comments on commit 3b4c357

Please sign in to comment.