summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
index cf726698f1..9c7a08428e 100644
--- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
@@ -175,9 +175,13 @@ void ControllerInterface::RemoveDevice(std::function<bool(const ciface::Core::De
//
void ControllerInterface::UpdateInput()
{
- std::lock_guard<std::mutex> lk(m_devices_mutex);
- for (const auto& d : m_devices)
- d->UpdateInput();
+ // Don't block the UI or CPU thread (to avoid a short but noticeable frame drop)
+ if (m_devices_mutex.try_lock())
+ {
+ std::lock_guard<std::mutex> lk(m_devices_mutex, std::adopt_lock);
+ for (const auto& d : m_devices)
+ d->UpdateInput();
+ }
}
//