DevMgr,Dev: Add Qutexes

Add Qutex locks to both DeviceManager and Device. These will be
properly used in the upcoming patches.
This commit is contained in:
2025-09-28 01:27:32 -04:00
parent 51b70b179c
commit 572a8612ed
2 changed files with 15 additions and 7 deletions
+5 -1
View File
@@ -7,6 +7,7 @@
#include <sstream>
#include <user/deviceAttachmentSpec.h>
#include <deviceManager/deviceRole.h>
#include <qutex.h>
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<std::shared_ptr<DeviceRole>> deviceRoles;
Qutex qutex;
};
} // namespace device
+10 -6
View File
@@ -14,6 +14,7 @@
#include <deviceManager/device.h>
#include <deviceManager/deviceRole.h>
#include <callback.h>
#include <qutex.h>
namespace smo {
namespace device {
@@ -69,17 +70,20 @@ public:
Callback<detachAllSenseDevicesReqCbFn> 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<std::shared_ptr<DeviceAttachmentSpec>>
deviceAttachmentSpecs;
static std::vector<std::shared_ptr<Device>> devices;
static std::vector<std::shared_ptr<DeviceRole>> attachedDeviceRoles;
Qutex qutex;
std::string allDapSpecs;
static std::vector<std::shared_ptr<DeviceAttachmentSpec>>
deviceAttachmentSpecs;
static std::vector<std::shared_ptr<Device>> devices;
static std::vector<std::shared_ptr<DeviceRole>> attachedDeviceRoles;
private:
class NewDeviceAttachmentSpecInd;