13 Asynchronous model [async]

13.25 Class template strand [async.strand]

13.25.4 strand operations [async.strand.ops]

inner_executor_type get_inner_executor() const noexcept;

Returns: inner_ex_.

bool running_in_this_thread() const noexcept;

Returns: true if the current thread of execution is running a function that was submitted to the strand, or to any other strand object s such that s == *this, using dispatch, post or defer; otherwise false. [ Note: That is, the current thread of execution's call chain includes a function that was submitted to the strand.  — end note ]

execution_context& context() const noexcept;

Returns: inner_ex_.context().

void on_work_started() const noexcept;

Effects: Calls inner_ex_.on_work_started().

void on_work_finished() const noexcept;

Effects: Calls inner_ex_.on_work_finished().

template<class Func, class ProtoAllocator> void dispatch(Func&& f, const ProtoAllocator& a) const;

Effects: If running_in_this_thread() is true, calls DECAY_COPY(forward<Func>(f))() (C++ 2014 [thread.decaycopy]). [ Note: If f exits via an exception, the exception propagates to the caller of dispatch().  — end note ] Otherwise, requests invocation of f, as if by forwarding the function object f and allocator a to the executor inner_ex_, such that the guarantees of ordering and non-concurrency are met.

template<class Func, class ProtoAllocator> void post(Func&& f, const ProtoAllocator& a) const;

Effects: Requests invocation of f, as if by forwarding the function object f and allocator a to the executor inner_ex_, such that the guarantees of ordering and non-concurrency are met.

template<class Func, class ProtoAllocator> void defer(Func&& f, const ProtoAllocator& a) const;

Effects: Requests invocation of f, as if by forwarding the function object f and allocator a to the executor inner_ex_, such that the guarantees of ordering and non-concurrency are met.