boost::capy::run_async

Bind an executor, a stop token, and a memory resource to produce a launcher. Invoke the launcher with a task to start it.

Synopsis

template<Executor Ex>
[[nodiscard]]
auto
run_async(
    Ex ex,
    std::stop_token st,
    std::pmr::memory_resource* mr);

Description

Construct the task as the direct argument of the two‐call expression run_async(ex)(task).

Thread Safety

The wrapper itself should only be used from one thread.

Return Value

A wrapper that accepts a task<T> for immediate execution.

The return value should not be discarded.

Parameters

Name

Description

ex

The executor to execute the task on.

st

The stop token for cooperative cancellation.

mr

The memory resource for frame allocation.

Preconditions

  • mr outlives every task started through the returned wrapper.

See Also