diff --git a/include/spinscale/co/dynamicPostingInvoker.h b/include/spinscale/co/dynamicPostingInvoker.h new file mode 100644 index 0000000..d663c04 --- /dev/null +++ b/include/spinscale/co/dynamicPostingInvoker.h @@ -0,0 +1,36 @@ +#ifndef DYNAMIC_POSTING_INVOKER_H +#define DYNAMIC_POSTING_INVOKER_H + +#include + +#include + +#include +#include + +namespace sscl::co { + +/** Fallback ThreadTag for DynamicViralPostingInvoker when ExplicitPostTarget is + * omitted. Callers must always pass ExplicitPostTarget in production paths. + */ +struct DynamicPostTargetThreadTag +{ + static boost::asio::io_context &io_context() + { + throw std::runtime_error( + std::string(__func__) + + ": ExplicitPostTarget required for DynamicViralPostingInvoker"); + } +}; + +template +using DynamicPostingPromise = + TaggedPostingPromise; + +template +using DynamicViralPostingInvoker = + ViralPostingInvoker; + +} // namespace sscl::co + +#endif // DYNAMIC_POSTING_INVOKER_H diff --git a/include/spinscale/co/postingPromise.h b/include/spinscale/co/postingPromise.h index 2d49b3e..a7161f5 100644 --- a/include/spinscale/co/postingPromise.h +++ b/include/spinscale/co/postingPromise.h @@ -223,8 +223,8 @@ struct PostingPromise ExplicitPostTarget _calleePostTarget, TailArgs &&...) noexcept : returnValues(), - postBackStatus(*this), - calleePostTarget(std::move(_calleePostTarget)) + calleePostTarget(std::move(_calleePostTarget)), + postBackStatus(*this) {} /** Viral / free-function entry: post-TO uses ThreadTag default. */