Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #11635 from Dentomologist/wiimote_fix_disconnectio…
…n_deadlock

ControllerInterface: Fix deadlock when Wii Remote disconnects
  • Loading branch information
delroth committed Mar 14, 2023
2 parents 970ddf0 + d6a8e6c commit 3783bed
Showing 1 changed file with 8 additions and 0 deletions.
Expand Up @@ -372,6 +372,14 @@ void ControllerInterface::UpdateInput()

// TODO: if we are an emulation input channel, we should probably always lock
// Prefer outdated values over blocking UI or CPU thread (avoids short but noticeable frame drop)

// Lock this first to avoid deadlock with m_devices_mutex in certain cases (such as a Wii Remote
// getting disconnected)
if (!m_devices_population_mutex.try_lock())
return;

std::lock_guard population_lock(m_devices_population_mutex, std::adopt_lock);

if (!m_devices_mutex.try_lock())
return;

Expand Down

0 comments on commit 3783bed

Please sign in to comment.