mirror of
https://github.com/latentPrion/libspinscale.git
synced 2026-06-23 19:48:32 +00:00
New DynamicViralPostingInvoker: takes runtime post-to target
This commit is contained in:
@@ -0,0 +1,36 @@
|
|||||||
|
#ifndef DYNAMIC_POSTING_INVOKER_H
|
||||||
|
#define DYNAMIC_POSTING_INVOKER_H
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
|
#include <boost/asio/io_context.hpp>
|
||||||
|
|
||||||
|
#include <spinscale/co/invokers.h>
|
||||||
|
#include <spinscale/co/postingPromise.h>
|
||||||
|
|
||||||
|
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<typename T>
|
||||||
|
using DynamicPostingPromise =
|
||||||
|
TaggedPostingPromise<T, DynamicPostTargetThreadTag>;
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
using DynamicViralPostingInvoker =
|
||||||
|
ViralPostingInvoker<DynamicPostingPromise, T>;
|
||||||
|
|
||||||
|
} // namespace sscl::co
|
||||||
|
|
||||||
|
#endif // DYNAMIC_POSTING_INVOKER_H
|
||||||
@@ -223,8 +223,8 @@ struct PostingPromise
|
|||||||
ExplicitPostTarget _calleePostTarget,
|
ExplicitPostTarget _calleePostTarget,
|
||||||
TailArgs &&...) noexcept
|
TailArgs &&...) noexcept
|
||||||
: returnValues(),
|
: returnValues(),
|
||||||
postBackStatus(*this),
|
calleePostTarget(std::move(_calleePostTarget)),
|
||||||
calleePostTarget(std::move(_calleePostTarget))
|
postBackStatus(*this)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/** Viral / free-function entry: post-TO uses ThreadTag default. */
|
/** Viral / free-function entry: post-TO uses ThreadTag default. */
|
||||||
|
|||||||
Reference in New Issue
Block a user