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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user