boost::capy::run_async

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

Synopsis

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

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. The handlers may be invoked from any thread where the executor schedules work.

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).

h1

The handler to invoke with the result (and optionally exception).

See Also