#include <Pt/System/EventLoop.h>
Awaitable that schedules a resume in the EventLoop. More...
Inherits Awaiter, and Selectable.
Public Member Functions | |
| bool | await_ready () const |
| Returns false so co_await always suspends. | |
| template<typename P > | |
| bool | await_suspend (std::coroutine_handle< P > h) |
| Starts the operation and suspends the coroutine. | |
Protected Member Functions | |
| void | onBegin () override |
| Starts the asynchronous operation. More... | |
| void | cancel () override |
| Cancels the in-flight operation. | |
| void | onCancel () override |
| Aborts the in-flight operation. More... | |
| void | onAttach (Pt::System::EventLoop &) override |
| Attached to loop. | |
| void | onDetach (Pt::System::EventLoop &) override |
| Detached from loop. | |
| bool | onRun () override |
| Check if ready and run. | |
| void | setReady () |
| Resumes the waiting coroutine. More... | |
This splits heavy coroutine computations into chunks avoiding EventLoop starvation for socket or UI events.
|
overrideprotectedvirtual |
Subscribe to completion and begin the work. The coroutine remains suspended until Awaiter::setReady() is called.
Implements Awaiter.
|
overrideprotectedvirtual |
Called from Awaiter::cancel() when the waiting task or generator is cancelled.
Implements Awaiter.
|
protectedinherited |
Call this when the asynchronous operation has completed. Typically connect a completion signal to this method.