diff options
| author | Leo Lam <leolino.lam@gmail.com> | 2017-12-15 21:05:17 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-12-15 21:05:17 +0100 |
| commit | 4733bbd8f38c0583aed0fd2faa2c9d577456bcfe (patch) | |
| tree | ee324a2fd8b127160ec9bdb8d5d8b89329d02868 /Source/Core/InputCommon/ControllerInterface/ControllerInterface.h | |
| parent | a4592bc3c54d37111b916d707beb2152fdebf5fb (diff) | |
| parent | 8e6677be90d67a652eb4bcf7d0b76f548e254172 (diff) | |
Merge pull request #6166 from ligfx/invokedeviceschangedcallbacks
ControllerInterface: cleanup callbacks API and logic
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/ControllerInterface.h')
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/ControllerInterface.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h index 23afab7d67..06fd7c544d 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h @@ -4,14 +4,12 @@ #pragma once -#include <algorithm> +#include <atomic> #include <functional> -#include <map> -#include <sstream> -#include <string> +#include <memory> +#include <mutex> #include <vector> -#include "Common/CommonTypes.h" #include "InputCommon/ControllerInterface/Device.h" // enable disable sources @@ -53,12 +51,14 @@ public: bool IsInit() const { return m_is_init; } void UpdateInput(); - void RegisterHotplugCallback(std::function<void(void)> callback); - void InvokeHotplugCallbacks() const; + void RegisterDevicesChangedCallback(std::function<void(void)> callback); + void InvokeDevicesChangedCallbacks() const; private: - std::vector<std::function<void()>> m_hotplug_callbacks; + std::vector<std::function<void()>> m_devices_changed_callbacks; + mutable std::mutex m_callbacks_mutex; bool m_is_init; + std::atomic<bool> m_is_populating_devices{false}; void* m_hwnd; }; |
