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
+10 -9
View File
@@ -2,6 +2,7 @@
#include <opts.h>
#include <asynchronousContinuation.h>
#include <asynchronousLoop.h>
#include <callback.h>
#include <body/body.h>
#include <componentThread.h>
#include <mind.h>
@@ -21,7 +22,7 @@ class Body::InitializeReq
public:
InitializeReq(
Mind &parent, const std::shared_ptr<ComponentThread> &caller,
bodyLifetimeMgmtOpCbFn callback)
Callback<bodyLifetimeMgmtOpCbFn> callback)
: PostedAsynchronousContinuation<bodyLifetimeMgmtOpCbFn>(caller, callback),
parent(parent)
{}
@@ -78,10 +79,10 @@ public:
}
sense_api::SenseApiManager::getInstance()
.attachAllSenseDevicesFromSpecsReq(
std::bind(
{context, std::bind(
&InitializeReq::initializeReq2,
context.get(), context,
std::placeholders::_1));
std::placeholders::_1)});
}
void initializeReq2(
@@ -117,10 +118,10 @@ public:
std::cout << "Mrntt: About to detach all sense devices." << "\n";
sense_api::SenseApiManager::getInstance().detachAllSenseDevicesReq(
std::bind(
{context, std::bind(
&FinalizeReq::finalizeReq2,
context.get(), context,
std::placeholders::_1));
std::placeholders::_1)});
}
void finalizeReq2(
@@ -141,7 +142,7 @@ public:
}
};
void Body::initializeReq(bodyLifetimeMgmtOpCbFn callback)
void Body::initializeReq(Callback<bodyLifetimeMgmtOpCbFn> callback)
{
auto mrntt = ComponentThread::getSelf();
@@ -160,7 +161,7 @@ void Body::initializeReq(bodyLifetimeMgmtOpCbFn callback)
request.get(), request));
}
void Body::finalizeReq(bodyLifetimeMgmtOpCbFn callback)
void Body::finalizeReq(Callback<bodyLifetimeMgmtOpCbFn> callback)
{
auto mrntt = ComponentThread::getSelf();
@@ -168,7 +169,7 @@ void Body::finalizeReq(bodyLifetimeMgmtOpCbFn callback)
{
std::cerr << __func__ << ": Must be invoked by Mrntt thread"
<< std::endl;
callback(false);
callback.callbackFn(false);
return;
}
@@ -176,7 +177,7 @@ void Body::finalizeReq(bodyLifetimeMgmtOpCbFn callback)
{
std::cout << "Mrntt: Body component not initialized. "
<< "Skipping finalization." << "\n";
callback(true);
callback.callbackFn(true);
return;
}