2025-12-28 03:54:22 -04:00
|
|
|
#ifndef ASYNCHRONOUS_CONTINUATION_CHAIN_LINK_H
|
|
|
|
|
#define ASYNCHRONOUS_CONTINUATION_CHAIN_LINK_H
|
|
|
|
|
|
2026-03-05 21:22:50 -04:00
|
|
|
#include <functional>
|
2025-12-28 03:54:22 -04:00
|
|
|
#include <memory>
|
2026-03-05 21:22:50 -04:00
|
|
|
#include <optional>
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <spinscale/lockSet.h>
|
2025-12-28 03:54:22 -04:00
|
|
|
|
|
|
|
|
namespace sscl {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Base class for all asynchronous continuation chain links
|
|
|
|
|
*
|
|
|
|
|
* This non-template base class provides type erasure for the continuation
|
|
|
|
|
* chain, allowing RTTI and dynamic casting when walking the chain.
|
|
|
|
|
*
|
|
|
|
|
* The chain walking logic can use dynamic_cast to determine the most
|
|
|
|
|
* derived type and perform appropriate operations.
|
|
|
|
|
*
|
|
|
|
|
* Inherits from enable_shared_from_this to allow objects to obtain a
|
|
|
|
|
* shared_ptr to themselves, which is useful for gridlock detection tracking.
|
|
|
|
|
*/
|
|
|
|
|
class AsynchronousContinuationChainLink
|
|
|
|
|
: public std::enable_shared_from_this<AsynchronousContinuationChainLink>
|
|
|
|
|
{
|
|
|
|
|
public:
|
2026-03-05 21:22:50 -04:00
|
|
|
virtual ~AsynchronousContinuationChainLink() = default;
|
2025-12-28 03:54:22 -04:00
|
|
|
|
|
|
|
|
virtual std::shared_ptr<AsynchronousContinuationChainLink>
|
|
|
|
|
getCallersContinuationShPtr() const = 0;
|
2026-03-05 21:22:50 -04:00
|
|
|
|
|
|
|
|
virtual std::optional<std::reference_wrapper<const LockSet>>
|
|
|
|
|
getLockSet() const
|
|
|
|
|
{ return std::nullopt; }
|
|
|
|
|
|
|
|
|
|
virtual std::optional<std::reference_wrapper<LockSet>> getLockSet()
|
|
|
|
|
{ return std::nullopt; }
|
2025-12-28 03:54:22 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace sscl
|
|
|
|
|
|
|
|
|
|
#endif // ASYNCHRONOUS_CONTINUATION_CHAIN_LINK_H
|