BasicAwaiter< void > Class Referenceabstract

#include <Pt/Coroutine.h>

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

Inherits Awaiter, and 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.
bool await_ready () const
 Returns false so co_await always suspends.
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.
void setReady ()
 Resumes the waiting coroutine.
virtual void onBegin ()=0
 Starts the asynchronous operation.
virtual void onCancel ()=0
 Aborts the in-flight operation.
void setReady ()
 Resumes the waiting coroutine.
virtual void onBegin ()=0
 Starts the asynchronous operation.
virtual void onCancel ()=0
 Aborts the in-flight operation.

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() [1/2]

void setReady ( )
protectedinherited

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

◆ onBegin() [1/2]

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() [1/2]

virtual void onCancel ( )
protectedpure virtualinherited

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

Implemented in ConnectionAwaiter, and AsyncYield.

◆ setReady() [2/2]

void setReady ( )
protected

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

◆ onBegin() [2/2]

virtual void onBegin ( )
protectedpure virtual

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

◆ onCancel() [2/2]

virtual void onCancel ( )
protectedpure virtual

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