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:
+6
-13
@@ -7,7 +7,7 @@
|
||||
namespace smo {
|
||||
|
||||
// Forward declaration
|
||||
class AsyncContinuation;
|
||||
class AsynchronousContinuationChainLink;
|
||||
|
||||
/**
|
||||
* @brief Callback class that wraps a function and its caller continuation
|
||||
@@ -15,23 +15,16 @@ class AsyncContinuation;
|
||||
* This class provides a way to pass both a callback function and the
|
||||
* caller's continuation in a single object, enabling deadlock detection
|
||||
* by walking the chain of continuations.
|
||||
*
|
||||
* Usage: Callback<CbFnT>{context, std::bind(...)}
|
||||
*/
|
||||
template<typename CbFnT>
|
||||
class Callback
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
* @param caller The caller's continuation
|
||||
* @param cb The callback function to invoke
|
||||
*/
|
||||
Callback(std::shared_ptr<AsyncContinuation> caller, std::function<CbFnT> cb)
|
||||
: callerContinuation(std::move(caller)), callback(std::move(cb))
|
||||
{}
|
||||
|
||||
public:
|
||||
std::shared_ptr<AsyncContinuation> callerContinuation;
|
||||
std::function<CbFnT> callback;
|
||||
// Aggregate initialization allows: Callback<CbFnT>{context, std::bind(...)}
|
||||
std::shared_ptr<AsynchronousContinuationChainLink> callerContinuation;
|
||||
CbFnT callbackFn;
|
||||
};
|
||||
|
||||
} // namespace smo
|
||||
|
||||
Reference in New Issue
Block a user