mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-09 12:40:03 +00:00
Merge pull request #2373 from jdieter/master
Reverts #2362 while still fixing deadlock when adding multiple Wiimotes
This commit is contained in:
commit
7b3bc9bfc7
@ -150,9 +150,9 @@ bool CCPU::PauseAndLock(bool doLock, bool unpauseOnUnlock)
|
|||||||
if (doLock)
|
if (doLock)
|
||||||
{
|
{
|
||||||
// we can't use EnableStepping, that would causes deadlocks with both audio and video
|
// we can't use EnableStepping, that would causes deadlocks with both audio and video
|
||||||
|
PowerPC::Pause();
|
||||||
if (!Core::IsCPUThread())
|
if (!Core::IsCPUThread())
|
||||||
m_csCpuOccupied.lock();
|
m_csCpuOccupied.lock();
|
||||||
PowerPC::Pause();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -829,7 +829,10 @@ void ControlChannel(int _WiimoteNumber, u16 _channelID, const void* _pData, u32
|
|||||||
// Read the Wiimote once
|
// Read the Wiimote once
|
||||||
void Update(int _WiimoteNumber)
|
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])
|
if (g_wiimotes[_WiimoteNumber])
|
||||||
g_wiimotes[_WiimoteNumber]->Update();
|
g_wiimotes[_WiimoteNumber]->Update();
|
||||||
@ -839,6 +842,7 @@ void Update(int _WiimoteNumber)
|
|||||||
{
|
{
|
||||||
Host_ConnectWiimote(_WiimoteNumber, false);
|
Host_ConnectWiimote(_WiimoteNumber, false);
|
||||||
}
|
}
|
||||||
|
g_refresh_lock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void StateChange(EMUSTATE_CHANGE newState)
|
void StateChange(EMUSTATE_CHANGE newState)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user