Files
libspinscale/include/spinscale/cps/callback.h
T

32 lines
772 B
C++
Raw Normal View History

2025-12-28 03:54:22 -04:00
#ifndef SPINSCALE_CALLBACK_H
#define SPINSCALE_CALLBACK_H
#include <memory>
2026-05-17 17:26:21 -04:00
namespace sscl::cps {
2025-12-28 03:54:22 -04:00
// Forward declaration
class AsynchronousContinuationChainLink;
/**
* @brief Callback class that wraps a function and its caller continuation
*
* 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:
// Aggregate initialization allows: Callback<CbFnT>{context, std::bind(...)}
std::shared_ptr<AsynchronousContinuationChainLink> callerContinuation;
CbFnT callbackFn;
};
2026-05-17 17:26:21 -04:00
} // namespace sscl::cps
2025-12-28 03:54:22 -04:00
#endif // SPINSCALE_CALLBACK_H