boost::capy::run_async

Bind an executor 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::pmr::memory_resource* mr);

Description

The memory resource is used for coroutine frame allocation.

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.

mr

The memory resource for frame allocation.

Preconditions

  • mr outlives every task started through the returned wrapper.

See Also