diff options
| author | skidau <skidau@gmail.com> | 2015-05-07 16:28:13 +1000 |
|---|---|---|
| committer | skidau <skidau@gmail.com> | 2015-05-07 16:28:13 +1000 |
| commit | 7b3bc9bfc73b41fce30df2bf4aa174c6b3d95d3e (patch) | |
| tree | aa690ba807e0b7b87b169ed742ebb820995f9f15 | |
| parent | 80fe5e0a55260eec17d905cd224919c3734c5876 (diff) | |
| parent | 3fe839d225c200245005f14b0a854bac327c871e (diff) | |
Merge pull request #2373 from jdieter/master
Reverts #2362 while still fixing deadlock when adding multiple Wiimotes
| -rw-r--r-- | Source/Core/Core/HW/CPU.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/Source/Core/Core/HW/CPU.cpp b/Source/Core/Core/HW/CPU.cpp index ff3c39d572..f583cc3dfe 100644 --- a/Source/Core/Core/HW/CPU.cpp +++ b/Source/Core/Core/HW/CPU.cpp @@ -150,9 +150,9 @@ bool CCPU::PauseAndLock(bool doLock, bool unpauseOnUnlock) if (doLock) { // we can't use EnableStepping, that would causes deadlocks with both audio and video + PowerPC::Pause(); if (!Core::IsCPUThread()) m_csCpuOccupied.lock(); - PowerPC::Pause(); } else { diff --git a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp index f64ab52769..319a6bddb7 100644 --- a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp @@ -829,7 +829,10 @@ void ControlChannel(int _WiimoteNumber, u16 _channelID, const void* _pData, u32 // Read the Wiimote once void Update(int _WiimoteNumber) { - std::lock_guard<std::recursive_mutex> lk(g_refresh_lock); + // Try to get a lock and return without doing anything if we fail + // This avoids deadlocks when adding a Wiimote during continuous scan + if(!g_refresh_lock.try_lock()) + return; if (g_wiimotes[_WiimoteNumber]) g_wiimotes[_WiimoteNumber]->Update(); @@ -839,6 +842,7 @@ void Update(int _WiimoteNumber) { Host_ConnectWiimote(_WiimoteNumber, false); } + g_refresh_lock.unlock(); } void StateChange(EMUSTATE_CHANGE newState) |
