Skip to content
Permalink
Browse files

Merge pull request #8332 from CookiePLMonster/dsp-lle-deadlock

DSPLLE: Put DSP thread in idle state when it's paused
  • Loading branch information
Helios747 committed Nov 27, 2019
2 parents 44f85bb + 5be9505 commit e33acc07f9b98b863f70483bac491f2d85601b4a
Showing with 23 additions and 13 deletions.
  1. +23 −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();
}
}

@@ -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

0 comments on commit e33acc0

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