boost::capy::run_async

Bind an executor and an allocator to produce a launcher. Invoke the launcher with a task to start it.

Synopsis

template<
    Executor Ex,
    /* implementation-defined */ Alloc>
[[nodiscard]]
auto
run_async(
    Ex ex,
    Alloc alloc);

Description

The allocator is wrapped in a frame_memory_resource and stored in the run_async_trampoline, ensuring it outlives all coroutine frames.

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.

alloc

The allocator for frame allocation (copied and stored).

See Also