Async: add sh_ptr<ContinuationChainLink> to Callback<>

This change enables us to finally implement the tracing of
continuations backward from the point of acquisition for deadlock
debugging.
This commit is contained in:
2025-09-27 18:30:09 -04:00
parent 2212aec080
commit 782bcd4567
26 changed files with 384 additions and 269 deletions
+17 -16
View File
@@ -8,6 +8,7 @@
#include <asynchronousBridge.h>
#include <asynchronousContinuation.h>
#include <asynchronousLoop.h>
#include <callback.h>
#include <user/senseApiDesc.h>
#include <mind.h>
#include <deviceManager/deviceManager.h>
@@ -268,7 +269,7 @@ public:
AttachSenseDeviceReq(
const std::shared_ptr<device::DeviceAttachmentSpec>& spec,
const std::shared_ptr<ComponentThread> &caller,
attachSenseDeviceReqCbFn cb)
Callback<attachSenseDeviceReqCbFn> cb)
: PostedAsynchronousContinuation<attachSenseDeviceReqCbFn>(
caller, cb),
spec(spec)
@@ -335,10 +336,10 @@ public:
lib.senseApiDesc.sal_mgmt_libOps.attachDeviceReq(
spec, threadForAttachment,
std::bind(
{context, std::bind(
&AttachSenseDeviceReq::attachSenseDeviceReq2,
context.get(), context,
std::placeholders::_1, std::placeholders::_2));
std::placeholders::_1, std::placeholders::_2)});
}
void attachSenseDeviceReq2(
@@ -386,10 +387,10 @@ public:
}
lib.senseApiDesc.sal_mgmt_libOps.detachDeviceReq(
spec,
std::bind(
{context, std::bind(
&DetachSenseDeviceReq::detachSenseDeviceReq2,
context.get(), context,
std::placeholders::_1, std::placeholders::_2));
std::placeholders::_1, std::placeholders::_2)});
}
void detachSenseDeviceReq2(
@@ -407,7 +408,7 @@ public:
void SenseApiManager::attachSenseDeviceReq(
const std::shared_ptr<device::DeviceAttachmentSpec>& spec,
attachSenseDeviceReqCbFn cb
Callback<attachSenseDeviceReqCbFn> cb
)
{
const auto& caller = ComponentThread::getSelf();
@@ -422,7 +423,7 @@ void SenseApiManager::attachSenseDeviceReq(
void SenseApiManager::detachSenseDeviceReq(
const std::shared_ptr<device::DeviceAttachmentSpec>& spec,
detachSenseDeviceReqCbFn cb
Callback<detachSenseDeviceReqCbFn> cb
)
{
const auto& caller = ComponentThread::getSelf();
@@ -443,7 +444,7 @@ public:
AttachAllSenseDevicesFromSpecsReq(
const unsigned int totalNSpecs,
const std::shared_ptr<ComponentThread>& caller,
attachAllSenseDevicesFromSpecsReqCbFn cb)
Callback<attachAllSenseDevicesFromSpecsReqCbFn> cb)
: PostedAsynchronousContinuation<attachAllSenseDevicesFromSpecsReqCbFn>(
caller, cb),
loop(totalNSpecs)
@@ -458,10 +459,10 @@ public:
{
SenseApiManager::getInstance().attachSenseDeviceReq(
spec,
std::bind(
{context, std::bind(
&AttachAllSenseDevicesFromSpecsReq::attachAllSenseDevicesFromSpecsReq2,
context.get(), context,
std::placeholders::_1, std::placeholders::_2));
std::placeholders::_1, std::placeholders::_2)});
}
}
@@ -499,13 +500,13 @@ public:
};
void SenseApiManager::attachAllSenseDevicesFromSpecsReq(
attachAllSenseDevicesFromSpecsReqCbFn cb
Callback<attachAllSenseDevicesFromSpecsReqCbFn> cb
)
{
if (device::DeviceManager::getInstance().deviceAttachmentSpecs.size() == 0)
{
AsynchronousLoop tmp(0);
cb(tmp);
cb.callbackFn(tmp);
return;
}
@@ -534,10 +535,10 @@ public:
{
SenseApiManager::getInstance().detachSenseDeviceReq(
spec,
std::bind(
{context, std::bind(
&DetachAllSenseDevicesReq::detachAllSenseDevicesReq2,
context.get(), context,
std::placeholders::_1, std::placeholders::_2));
std::placeholders::_1, std::placeholders::_2)});
}
}
@@ -571,13 +572,13 @@ public:
};
void SenseApiManager::detachAllSenseDevicesReq(
detachAllSenseDevicesReqCbFn cb
Callback<detachAllSenseDevicesReqCbFn> cb
)
{
if (device::DeviceManager::getInstance().deviceAttachmentSpecs.size() == 0)
{
AsynchronousLoop tmp(0);
cb(tmp);
cb.callbackFn(tmp);
return;
}