DevMgr:at/detachSenseDevReq: Acquire DevMgr Qutex

This commit is contained in:
2025-09-30 14:22:51 -04:00
parent 296e517389
commit b0d61c3e38
+8 -5
View File
@@ -7,6 +7,7 @@
#include <memory>
#include <opts.h>
#include <asynchronousContinuation.h>
#include <serializedAsynchronousContinuation.h>
#include <callback.h>
#include <componentThread.h>
#include <deviceManager/deviceManager.h>
@@ -316,15 +317,15 @@ void DeviceManager::removeDeviceAttachmentSpecReq(
}
class DeviceManager::AttachSenseDeviceReq
: public PostedAsynchronousContinuation<attachSenseDeviceReqCbFn>
: public SerializedAsynchronousContinuation<attachSenseDeviceReqCbFn>
{
public:
AttachSenseDeviceReq(
const std::shared_ptr<DeviceAttachmentSpec>& spec,
const std::shared_ptr<ComponentThread> &caller,
Callback<attachSenseDeviceReqCbFn> cb)
: PostedAsynchronousContinuation<attachSenseDeviceReqCbFn>(
caller, cb),
: SerializedAsynchronousContinuation<attachSenseDeviceReqCbFn>(
caller, cb, {std::ref(DeviceManager::getInstance().qutex)}),
spec(spec)
{}
@@ -469,7 +470,8 @@ void DeviceManager::attachSenseDeviceReq(
auto request = std::make_shared<AttachSenseDeviceReq>(
spec, caller, cb);
mrntt::mrntt.thread->getIoService().post(
AttachSenseDeviceReq::LockerAndInvoker lockvoker(
*request, mrntt::mrntt.thread,
std::bind(
&AttachSenseDeviceReq::attachSenseDeviceReq1_posted,
request.get(), request));
@@ -484,7 +486,8 @@ void DeviceManager::detachSenseDeviceReq(
auto request = std::make_shared<DetachSenseDeviceReq>(
spec, caller, cb);
mrntt::mrntt.thread->getIoService().post(
DetachSenseDeviceReq::LockerAndInvoker lockvoker(
*request, mrntt::mrntt.thread,
std::bind(
&DetachSenseDeviceReq::detachSenseDeviceReq1_posted,
request.get(), request));