dolphin/Source/Core/InputCommon
Filoppi 1badceb455 ControllerInterface: fix UpdateReferences() deadlock
Removed useless locks to DeviceContainer::m_devices_mutex, as they were all already protected by m_devices_population_mutex.
We have no interest in blocking other threads that were potentially reading devices at the same time so this seems fine.
This simplifies the code, and I've adjusted a few comments which mentioned possible deadlock that should now be totally gone.

The deadlock could have happen if a thread directly called EmulatedController::UpdateReferences(), while another another thread also reached EmulatedController::UpdateReferences() within a call to ControllerInterface::UpdateDevices(), as the mentioned function locked both the DeviceContainer::m_devices_mutex and s_get_state_mutex at the same time.

The deadlock was frequent on game emulation startup on Android, due to the UpdateReferences() call in InputConfig::LoadConfig() and the UI thread triggering calls to ControllerInterface::UpdateDevices().
It could also have happened on Desktop if a user pressed "Refresh Devices" manually in the UI while the input config was loading.

Also brought some UpdateReferences() comments and thread safety fixes from https://github.com/dolphin-emu/dolphin/pull/9489
2021-11-20 16:54:36 +02:00
..
ControllerEmu ControllerInterface: fix UpdateReferences() deadlock 2021-11-20 16:54:36 +02:00
ControllerInterface ControllerInterface: fix UpdateReferences() deadlock 2021-11-20 16:54:36 +02:00
ControlReference Fix all uninitialized variable warnings (C26495) 2021-10-13 12:32:16 -07:00
DynamicInputTextures treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
CMakeLists.txt InputCommon: Move initial dynamic input texture configuration logic to a 'specification 1' function and load in a 'specification' attribute that defaults to 1 if not present (with 1 being the only valid value at the moment) 2021-02-19 00:02:15 -06:00
DynamicInputTextureManager.cpp treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
DynamicInputTextureManager.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
GCAdapter_Android.cpp treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
GCAdapter.cpp treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
GCAdapter.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
GCPadStatus.h Fix all uninitialized variable warnings (C26495) 2021-10-13 12:32:16 -07:00
ImageOperations.cpp treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
ImageOperations.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
InputConfig.cpp Pad: GBA config 2021-07-13 16:42:35 +02:00
InputConfig.h Pad: GBA config 2021-07-13 16:42:35 +02:00
InputProfile.cpp treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
InputProfile.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
KeyboardStatus.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00