Home | Libraries | People | FAQ | More |
A completion token that represents the currently executing coroutine.
template< typename Executor> class await_token
Name |
Description |
---|---|
The associated executor type. |
Name |
Description |
---|---|
Copy constructor. |
|
Get the associated executor. |
The experimental::await_token
class is used to represent the currently executing coroutine. An experimental::await_token
may be passed as a handler to an asynchronous operation. For example:
awaitable<void> my_coroutine() { await_token token = co_await this_coro::token(); ... std::size_t n = co_await my_socket.async_read_some(buffer, token); ... }
The initiating function (async_read_some in the above example) suspends the current coroutine. The coroutine is resumed when the asynchronous operation completes, and the result of the operation is returned.
Header: boost/asio/experimental/co_spawn.hpp
Convenience header: boost/asio/experimental.hpp