boost::capy::run_async

Asynchronously launch a lazy task on the given executor.

Synopsis

template<Executor Ex>
[[nodiscard]]
auto
run_async(Ex ex);

Description

Use this to start execution of a task<T> that was created lazily. The returned wrapper must be immediately invoked with the task; storing the wrapper and calling it later violates LIFO ordering.

Uses the default recycling frame allocator for coroutine frames. With no handlers, the result is discarded and exceptions are rethrown.

Thread Safety

The wrapper and handlers may be called from any thread where the executor schedules work.

Example

run_async(ioc.get_executor())(my_task());

Return Value

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

Parameters

Name Description

ex

The executor to execute the task on.

See Also

task

executor

Created with MrDocs