Async: add TargetedContinuation

This class enables us to consistently represent continuations
that are intended to be posted on a particular target handling
thread. It hols a sh_ptr to the caller so that the target thread
can re-enqueue the response on the caller after processing the
REQ/IND op.
This commit is contained in:
2025-09-11 18:37:48 -04:00
parent f5195450e4
commit b8c931397d
3 changed files with 51 additions and 13 deletions
+30
View File
@@ -3,6 +3,9 @@
#include <functional>
#include <memory>
#include <componentThread.h>
namespace smo {
/**
* AsynchronousContinuation - Template base class for async sequence management
@@ -47,4 +50,31 @@ protected:
OriginalCbFnT originalCbFn;
};
class ContinuationTarget
{
public:
ContinuationTarget(
const std::shared_ptr<ComponentThread> &caller)
: caller(caller)
{}
public:
const std::shared_ptr<ComponentThread> caller;
};
template <class OriginalCbFnT>
class TargetedAsynchronousContinuation
: public AsynchronousContinuation<OriginalCbFnT>, public ContinuationTarget
{
public:
TargetedAsynchronousContinuation(
const std::shared_ptr<ComponentThread> &caller,
OriginalCbFnT originalCbFn)
: AsynchronousContinuation<OriginalCbFnT>(originalCbFn),
ContinuationTarget(caller)
{}
};
} // namespace smo
#endif // ASYNCHRONOUS_CONTINUATION_H