Skip to content
Permalink
Browse files

DSPLLE: Put DSP thread in idle state if it's paused to prevent a dead…

…lock

DSP thread is considered "idle" when it signals s_ppc_event and waits for s_dsp_event,
without putting it in this state when m_dsp_thread_mutex is locked it was possible to
create a deadlock between a DSP thread, emulation thread and Qt thread by accessing
Config menu immediately after booting up the game
  • Loading branch information
CookiePLMonster committed Aug 25, 2019
1 parent 28f7c5f commit e30ff7c327ff64d3a226476a0fd7165abc6e7937
Showing with 15 additions and 13 deletions.
  1. +15 −13 Source/Core/Core/HW/DSPLLE/DSPLLE.cpp
@@ -98,22 +98,24 @@ void DSPLLE::DSPThread(DSPLLE* dsp_lle)
const int cycles = static_cast<int>(dsp_lle->m_cycle_count.load());
if (cycles > 0)
{
std::lock_guard<std::mutex> 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();
}
}

0 comments on commit e30ff7c

Please sign in to comment.
You can’t perform that action at this time.