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 <memory>
#include <opts.h> #include <opts.h>
#include <asynchronousContinuation.h> #include <asynchronousContinuation.h>
#include <serializedAsynchronousContinuation.h>
#include <callback.h> #include <callback.h>
#include <componentThread.h> #include <componentThread.h>
#include <deviceManager/deviceManager.h> #include <deviceManager/deviceManager.h>
@@ -316,15 +317,15 @@ void DeviceManager::removeDeviceAttachmentSpecReq(
} }
class DeviceManager::AttachSenseDeviceReq class DeviceManager::AttachSenseDeviceReq
: public PostedAsynchronousContinuation<attachSenseDeviceReqCbFn> : public SerializedAsynchronousContinuation<attachSenseDeviceReqCbFn>
{ {
public: public:
AttachSenseDeviceReq( AttachSenseDeviceReq(
const std::shared_ptr<DeviceAttachmentSpec>& spec, const std::shared_ptr<DeviceAttachmentSpec>& spec,
const std::shared_ptr<ComponentThread> &caller, const std::shared_ptr<ComponentThread> &caller,
Callback<attachSenseDeviceReqCbFn> cb) Callback<attachSenseDeviceReqCbFn> cb)
: PostedAsynchronousContinuation<attachSenseDeviceReqCbFn>( : SerializedAsynchronousContinuation<attachSenseDeviceReqCbFn>(
caller, cb), caller, cb, {std::ref(DeviceManager::getInstance().qutex)}),
spec(spec) spec(spec)
{} {}
@@ -469,7 +470,8 @@ void DeviceManager::attachSenseDeviceReq(
auto request = std::make_shared<AttachSenseDeviceReq>( auto request = std::make_shared<AttachSenseDeviceReq>(
spec, caller, cb); spec, caller, cb);
mrntt::mrntt.thread->getIoService().post( AttachSenseDeviceReq::LockerAndInvoker lockvoker(
*request, mrntt::mrntt.thread,
std::bind( std::bind(
&AttachSenseDeviceReq::attachSenseDeviceReq1_posted, &AttachSenseDeviceReq::attachSenseDeviceReq1_posted,
request.get(), request)); request.get(), request));
@@ -484,7 +486,8 @@ void DeviceManager::detachSenseDeviceReq(
auto request = std::make_shared<DetachSenseDeviceReq>( auto request = std::make_shared<DetachSenseDeviceReq>(
spec, caller, cb); spec, caller, cb);
mrntt::mrntt.thread->getIoService().post( DetachSenseDeviceReq::LockerAndInvoker lockvoker(
*request, mrntt::mrntt.thread,
std::bind( std::bind(
&DetachSenseDeviceReq::detachSenseDeviceReq1_posted, &DetachSenseDeviceReq::detachSenseDeviceReq1_posted,
request.get(), request)); request.get(), request));