diff --git a/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp b/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp index 6f27f485fc..fed94099bc 100644 --- a/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp +++ b/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp @@ -98,22 +98,24 @@ void DSPLLE::DSPThread(DSPLLE* dsp_lle) const int cycles = static_cast(dsp_lle->m_cycle_count.load()); if (cycles > 0) { - std::lock_guard dsp_thread_lock(dsp_lle->m_dsp_thread_mutex); - if (g_dsp_jit) + std::unique_lock dsp_thread_lock(dsp_lle->m_dsp_thread_mutex, std::try_to_lock); + if (dsp_thread_lock) { - DSPCore_RunCycles(cycles); + if (g_dsp_jit) + { + DSPCore_RunCycles(cycles); + } + else + { + DSP::Interpreter::RunCyclesThread(cycles); + } + dsp_lle->m_cycle_count.store(0); + continue; } - else - { - DSP::Interpreter::RunCyclesThread(cycles); - } - dsp_lle->m_cycle_count.store(0); - } - else - { - s_ppc_event.Set(); - s_dsp_event.Wait(); } + + s_ppc_event.Set(); + s_dsp_event.Wait(); } } @@ -334,8 +336,16 @@ u32 DSPLLE::DSP_UpdateRate() void DSPLLE::PauseAndLock(bool do_lock, bool unpause_on_unlock) { if (do_lock) + { m_dsp_thread_mutex.lock(); + } else + { m_dsp_thread_mutex.unlock(); + + // Signal the DSP thread so it can perform any outstanding work now (if any) + s_ppc_event.Wait(); + s_dsp_event.Set(); + } } } // namespace DSP::LLE