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
+6 -5
View File
@@ -7,6 +7,7 @@
#include <memory>
#include <opts.h>
#include <asynchronousContinuation.h>
#include <callback.h>
#include <deviceManager/deviceManager.h>
#include <senseApis/senseApiManager.h>
#include <marionette/marionette.h>
@@ -45,7 +46,7 @@ public:
NewDeviceAttachmentSpecInd(
std::shared_ptr<DeviceAttachmentSpec> s,
const std::shared_ptr<ComponentThread> &caller,
newDeviceAttachmentSpecIndCbFn cb)
Callback<newDeviceAttachmentSpecIndCbFn> cb)
: PostedAsynchronousContinuation<newDeviceAttachmentSpecIndCbFn>(
caller, cb),
spec(s)
@@ -61,10 +62,10 @@ public:
{
sense_api::SenseApiManager::getInstance().attachSenseDeviceReq(
spec,
std::bind(
{context, std::bind(
&NewDeviceAttachmentSpecInd::newDeviceAttachmentSpecInd2,
context.get(), context,
std::placeholders::_1, std::placeholders::_2));
std::placeholders::_1, std::placeholders::_2)});
}
void newDeviceAttachmentSpecInd2(
@@ -125,14 +126,14 @@ public:
void DeviceManager::newDeviceAttachmentSpecInd(
std::shared_ptr<DeviceAttachmentSpec> spec,
newDeviceAttachmentSpecIndCbFn callback)
Callback<newDeviceAttachmentSpecIndCbFn> callback)
{
// Check if a DeviceAttachmentSpec already matches
for (const auto& existingSpec : deviceAttachmentSpecs)
{
if (!(*existingSpec == *spec)) { continue; }
// Already exists, callback with error
callback(false, nullptr, spec);
callback.callbackFn(false, nullptr, spec);
return;
}