BasicAwaiter< void > Class Referenceabstract

#include <Pt/Coroutine.h>

Specializes BasicAwaiter for awaitables without a result. More...

Inherits Awaiter.

Inherited by AsyncWait.

Public Member Functions

void await_resume ()
 Resumes the coroutine after the operation completed.
 
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.
 
void cancel () override
 Cancels the in-flight operation.
 

Protected Member Functions

virtual void onReady ()=0
 Finalizes the operation when the awaitable resumes. More...
 
void setReady ()
 Resumes the waiting coroutine. More...
 
virtual void onBegin ()=0
 Starts the asynchronous operation. More...
 
virtual void onCancel ()=0
 Aborts the in-flight operation. More...
 

Detailed Description

Use this when the operation completes without producing a value. Implement BasicAwaiter::onReady() to finalize or clean up.

Member Function Documentation

◆ onReady()

virtual void onReady ( )
protectedpure virtual

Called exactly once when the coroutine is resumed.

◆ setReady()

void setReady ( )
protectedinherited

Call this when the asynchronous operation has completed. Typically connect a completion signal to this method.

◆ onBegin()

virtual void onBegin ( )
protectedpure virtualinherited

Subscribe to completion and begin the work. The coroutine remains suspended until Awaiter::setReady() is called.

Implemented in AsyncYield.

◆ onCancel()

virtual void onCancel ( )
protectedpure virtualinherited

Called from Awaiter::cancel() when the waiting task or generator is cancelled.

Implemented in AsyncYield.