From 572a8612ed416e52001c86007a8245cd17ff898d Mon Sep 17 00:00:00 2001 From: Hayodea Hekol Date: Sun, 28 Sep 2025 01:27:32 -0400 Subject: [PATCH] DevMgr,Dev: Add Qutexes Add Qutex locks to both DeviceManager and Device. These will be properly used in the upcoming patches. --- smocore/include/deviceManager/device.h | 6 +++++- smocore/include/deviceManager/deviceManager.h | 16 ++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/smocore/include/deviceManager/device.h b/smocore/include/deviceManager/device.h index 3052721..b9b9456 100644 --- a/smocore/include/deviceManager/device.h +++ b/smocore/include/deviceManager/device.h @@ -7,6 +7,7 @@ #include #include #include +#include namespace smo { namespace device { @@ -14,7 +15,9 @@ namespace device { class Device { public: - Device(const std::string& identifier) : deviceIdentifier(identifier) {} + Device(const std::string& identifier) + : deviceIdentifier(identifier), qutex("Device-" + identifier) + {} std::string stringify() const { @@ -30,6 +33,7 @@ public: public: std::string deviceIdentifier; std::vector> deviceRoles; + Qutex qutex; }; } // namespace device diff --git a/smocore/include/deviceManager/deviceManager.h b/smocore/include/deviceManager/deviceManager.h index f195881..b37a8f2 100644 --- a/smocore/include/deviceManager/deviceManager.h +++ b/smocore/include/deviceManager/deviceManager.h @@ -14,6 +14,7 @@ #include #include #include +#include namespace smo { namespace device { @@ -69,17 +70,20 @@ public: Callback cb); private: - DeviceManager() = default; + DeviceManager() + : qutex("DeviceManager") + {} ~DeviceManager() = default; DeviceManager(const DeviceManager&) = delete; DeviceManager& operator=(const DeviceManager&) = delete; public: - std::string allDapSpecs; - static std::vector> - deviceAttachmentSpecs; - static std::vector> devices; - static std::vector> attachedDeviceRoles; + Qutex qutex; + std::string allDapSpecs; + static std::vector> + deviceAttachmentSpecs; + static std::vector> devices; + static std::vector> attachedDeviceRoles; private: class NewDeviceAttachmentSpecInd;