boost::capy::run_async
Asynchronously launch a lazy task with stop token support.
Synopsis
Declared in <boost/capy/ex/run_async.hpp>
template<Executor Ex>
[[nodiscard]]
auto
run_async(
Ex ex,
std::stop_token st);
Description
The stop token is propagated to the task, enabling cooperative cancellation. With no handlers, the result is discarded and exceptions are rethrown.
Example
std::stop_source source;
run_async(ex, source.get_token())(cancellable_task());
// Later: source.request_stop();
Parameters
| Name | Description |
|---|---|
ex |
The executor to execute the task on. |
st |
The stop token for cooperative cancellation. |