Awaitable object representing an event. More...
#include "event_router.h"
Public Member Functions | |
awaitable (awaitable &&rhs) noexcept | |
Move constructor. More... | |
awaitable (const awaitable &)=delete | |
This object is not copyable. More... | |
constexpr bool | await_ready () const noexcept |
First function called by the standard library when awaiting this object. More... | |
const T & | await_resume () |
Third and final function called by the standard library, called when resuming the coroutine. More... | |
void | await_suspend (detail::std_coroutine::coroutine_handle<> caller) |
Second function called by the standard library when awaiting this object, after suspension. More... | |
void | cancel () |
Request cancellation. More... | |
awaitable & | operator= (awaitable &&rhs) noexcept |
Move assignment operator. More... | |
awaitable & | operator= (const awaitable &)=delete |
This object is not copyable. More... | |
Friends | |
class | event_router_t< T > |
Awaitable object representing an event.
A user can co_await on this object to resume the next time the event is fired, optionally with a condition.
|
delete |
This object is not copyable.
|
inlinenoexcept |
Move constructor.
|
constexprnoexcept |
First function called by the standard library when awaiting this object.
Returns true if we need to suspend.
false | always. |
const T & dpp::detail::event_router::awaitable< T >::await_resume |
Third and final function called by the standard library, called when resuming the coroutine.
void dpp::detail::event_router::awaitable< T >::await_suspend | ( | detail::std_coroutine::coroutine_handle<> | caller | ) |
Second function called by the standard library when awaiting this object, after suspension.
This will attach the object to its event router, to be resumed on the next event that satisfies the predicate.
void dpp::detail::event_router::awaitable< T >::cancel |
Request cancellation.
This will detach this object from the event router and resume the awaiter, which will be thrown dpp::task_cancelled::exception.
??? | As this resumes the coroutine, it may throw any exceptions at the caller. |
If state == none (was never awaited), do nothing If state == waiting, prevent resumption, resume on our end If state == resuming || cancelling, ignore
|
inlinenoexcept |
Move assignment operator.
|
delete |
This object is not copyable.
|
friend |