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
+3 -2
View File
@@ -3,6 +3,7 @@
#include <component.h>
#include <functional>
#include <callback.h>
namespace smo {
@@ -19,8 +20,8 @@ public:
~Body() = default;
typedef std::function<void(bool)> bodyLifetimeMgmtOpCbFn;
void initializeReq(bodyLifetimeMgmtOpCbFn callback);
void finalizeReq(bodyLifetimeMgmtOpCbFn callback);
void initializeReq(Callback<bodyLifetimeMgmtOpCbFn> callback);
void finalizeReq(Callback<bodyLifetimeMgmtOpCbFn> callback);
private:
class InitializeReq;
+3 -2
View File
@@ -4,6 +4,7 @@
#include <config.h>
#include <memory>
#include <functional>
#include <callback.h>
namespace smo {
@@ -44,8 +45,8 @@ public:
public:
typedef std::function<void(bool)> mrnttLifetimeMgmtOpCbFn;
void initializeReq(mrnttLifetimeMgmtOpCbFn callback);
void finalizeReq(mrnttLifetimeMgmtOpCbFn callback);
void initializeReq(Callback<mrnttLifetimeMgmtOpCbFn> callback);
void finalizeReq(Callback<mrnttLifetimeMgmtOpCbFn> callback);
private:
class MrnttLifetimeMgmtOp;
+6 -5
View File
@@ -12,6 +12,7 @@
#include <sched.h>
#include <unistd.h>
#include <memory>
#include <callback.h>
namespace smo {
@@ -137,10 +138,10 @@ public:
// Thread management methods
typedef std::function<void()> threadLifetimeMgmtOpCbFn;
void startThreadReq(threadLifetimeMgmtOpCbFn callback);
void exitThreadReq(threadLifetimeMgmtOpCbFn callback);
void pauseThreadReq(threadLifetimeMgmtOpCbFn callback);
void resumeThreadReq(threadLifetimeMgmtOpCbFn callback);
void startThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback);
void exitThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback);
void pauseThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback);
void resumeThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback);
/**
* JOLTs this thread to begin processing after global initialization.
@@ -149,7 +150,7 @@ public:
* event loops and set up TLS vars after all global constructors have
* completed. This prevents race conditions during system startup.
*/
void joltThreadReq(threadLifetimeMgmtOpCbFn callback);
void joltThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback);
// CPU management methods
void pinToCpu(int cpuId);
@@ -10,6 +10,7 @@
#include <functional>
#include <user/deviceAttachmentSpec.h>
#include <deviceManager/device.h>
#include <callback.h>
namespace smo {
namespace device {
@@ -41,7 +42,7 @@ public:
newDeviceAttachmentSpecIndCbFn;
void newDeviceAttachmentSpecInd(
std::shared_ptr<DeviceAttachmentSpec> spec,
newDeviceAttachmentSpecIndCbFn callback);
Callback<newDeviceAttachmentSpecIndCbFn> callback);
private:
DeviceManager() = default;
+11 -7
View File
@@ -7,6 +7,7 @@
#include <memory>
#include <unordered_map>
#include <string>
#include <callback.h>
#include <component.h>
#include <componentThread.h>
@@ -23,8 +24,8 @@ public:
~Mind(void) = default;
typedef std::function<void(bool)> mindLifetimeMgmtOpCbFn;
void initializeReq(mindLifetimeMgmtOpCbFn callback);
void finalizeReq(mindLifetimeMgmtOpCbFn callback);
void initializeReq(Callback<mindLifetimeMgmtOpCbFn> callback);
void finalizeReq(Callback<mindLifetimeMgmtOpCbFn> callback);
// ComponentThread access methods
std::shared_ptr<MindThread> getComponentThread(
@@ -36,11 +37,14 @@ public:
// Thread management methods (moved from ComponentThread)
typedef std::function<void()> mindThreadLifetimeMgmtOpCbFn;
void joltAllMindThreadsReq(mindThreadLifetimeMgmtOpCbFn callback);
void startAllMindThreadsReq(mindThreadLifetimeMgmtOpCbFn callback);
void pauseAllMindThreadsReq(mindThreadLifetimeMgmtOpCbFn callback);
void resumeAllMindThreadsReq(mindThreadLifetimeMgmtOpCbFn callback);
void exitAllMindThreadsReq(mindThreadLifetimeMgmtOpCbFn callback);
void joltAllMindThreadsReq(Callback<mindThreadLifetimeMgmtOpCbFn> callback);
void startAllMindThreadsReq(
Callback<mindThreadLifetimeMgmtOpCbFn> callback);
void pauseAllMindThreadsReq(
Callback<mindThreadLifetimeMgmtOpCbFn> callback);
void resumeAllMindThreadsReq(
Callback<mindThreadLifetimeMgmtOpCbFn> callback);
void exitAllMindThreadsReq(Callback<mindThreadLifetimeMgmtOpCbFn> callback);
// CPU distribution method
void distributeAndPinThreadsAcrossCpus();
+5 -4
View File
@@ -11,6 +11,7 @@
#include <asynchronousLoop.h>
#include <senseApis/senseApiLib.h>
#include <user/deviceAttachmentSpec.h>
#include <callback.h>
namespace smo {
namespace sense_api {
@@ -54,10 +55,10 @@ public:
void attachSenseDeviceReq(
const std::shared_ptr<device::DeviceAttachmentSpec>& spec,
attachSenseDeviceReqCbFn cb);
Callback<attachSenseDeviceReqCbFn> cb);
void detachSenseDeviceReq(
const std::shared_ptr<device::DeviceAttachmentSpec>& spec,
detachSenseDeviceReqCbFn cb);
Callback<detachSenseDeviceReqCbFn> cb);
typedef std::function<void(AsynchronousLoop &results)>
attachAllSenseDevicesFromSpecsReqCbFn;
@@ -65,9 +66,9 @@ public:
detachAllSenseDevicesReqCbFn;
void attachAllSenseDevicesFromSpecsReq(
attachAllSenseDevicesFromSpecsReqCbFn cb);
Callback<attachAllSenseDevicesFromSpecsReqCbFn> cb);
void detachAllSenseDevicesReq(
detachAllSenseDevicesReqCbFn cb);
Callback<detachAllSenseDevicesReqCbFn> cb);
std::string stringifyLibs() const;