diff options
author | Narr the Reg <juangerman-13@hotmail.com> | 2022-04-07 20:52:51 +0200 |
---|---|---|
committer | Narr the Reg <juangerman-13@hotmail.com> | 2022-04-07 20:52:51 +0200 |
commit | 9c85cb354a6c00f82278e6c39d4b474c49dd4c5a (patch) | |
tree | 4dfac6429ce3019c7c7a8d4f477f6ac8ec873915 /src/core/hid/emulated_devices.cpp | |
parent | core: hid: Reduce the amount of dataraces (diff) | |
download | yuzu-9c85cb354a6c00f82278e6c39d4b474c49dd4c5a.tar yuzu-9c85cb354a6c00f82278e6c39d4b474c49dd4c5a.tar.gz yuzu-9c85cb354a6c00f82278e6c39d4b474c49dd4c5a.tar.bz2 yuzu-9c85cb354a6c00f82278e6c39d4b474c49dd4c5a.tar.lz yuzu-9c85cb354a6c00f82278e6c39d4b474c49dd4c5a.tar.xz yuzu-9c85cb354a6c00f82278e6c39d4b474c49dd4c5a.tar.zst yuzu-9c85cb354a6c00f82278e6c39d4b474c49dd4c5a.zip |
Diffstat (limited to 'src/core/hid/emulated_devices.cpp')
-rw-r--r-- | src/core/hid/emulated_devices.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/core/hid/emulated_devices.cpp b/src/core/hid/emulated_devices.cpp index f899f8ac0..cc0dcd931 100644 --- a/src/core/hid/emulated_devices.cpp +++ b/src/core/hid/emulated_devices.cpp @@ -411,47 +411,47 @@ void EmulatedDevices::SetMouseStick(const Common::Input::CallbackStatus& callbac } KeyboardValues EmulatedDevices::GetKeyboardValues() const { - std::lock_guard lock{mutex}; + std::scoped_lock lock{mutex}; return device_status.keyboard_values; } KeyboardModifierValues EmulatedDevices::GetKeyboardModdifierValues() const { - std::lock_guard lock{mutex}; + std::scoped_lock lock{mutex}; return device_status.keyboard_moddifier_values; } MouseButtonValues EmulatedDevices::GetMouseButtonsValues() const { - std::lock_guard lock{mutex}; + std::scoped_lock lock{mutex}; return device_status.mouse_button_values; } KeyboardKey EmulatedDevices::GetKeyboard() const { - std::lock_guard lock{mutex}; + std::scoped_lock lock{mutex}; return device_status.keyboard_state; } KeyboardModifier EmulatedDevices::GetKeyboardModifier() const { - std::lock_guard lock{mutex}; + std::scoped_lock lock{mutex}; return device_status.keyboard_moddifier_state; } MouseButton EmulatedDevices::GetMouseButtons() const { - std::lock_guard lock{mutex}; + std::scoped_lock lock{mutex}; return device_status.mouse_button_state; } MousePosition EmulatedDevices::GetMousePosition() const { - std::lock_guard lock{mutex}; + std::scoped_lock lock{mutex}; return device_status.mouse_position_state; } AnalogStickState EmulatedDevices::GetMouseWheel() const { - std::lock_guard lock{mutex}; + std::scoped_lock lock{mutex}; return device_status.mouse_wheel_state; } void EmulatedDevices::TriggerOnChange(DeviceTriggerType type) { - std::lock_guard lock{callback_mutex}; + std::scoped_lock lock{callback_mutex}; for (const auto& poller_pair : callback_list) { const InterfaceUpdateCallback& poller = poller_pair.second; if (poller.on_change) { @@ -461,13 +461,13 @@ void EmulatedDevices::TriggerOnChange(DeviceTriggerType type) { } int EmulatedDevices::SetCallback(InterfaceUpdateCallback update_callback) { - std::lock_guard lock{callback_mutex}; + std::scoped_lock lock{callback_mutex}; callback_list.insert_or_assign(last_callback_key, std::move(update_callback)); return last_callback_key++; } void EmulatedDevices::DeleteCallback(int key) { - std::lock_guard lock{callback_mutex}; + std::scoped_lock lock{callback_mutex}; const auto& iterator = callback_list.find(key); if (iterator == callback_list.end()) { LOG_ERROR(Input, "Tried to delete non-existent callback {}", key); |