ConnectionAwaiter Class Referenceabstract

#include <Pt/Db/Connection.h>

Base awaiter for a pending connection operation.

Inherits Awaiter, and Connectable.

Inherited by AsyncClose, AsyncExecute, AsyncOpen, AsyncPing, and AsyncSelect.

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.
void cancel () override
 Cancels the in-flight operation.

Protected Member Functions

void onCancel () override
 Aborts the in-flight operation.
void setReady ()
 Resumes the waiting coroutine.
virtual void onBegin ()=0
 Starts the asynchronous operation.

Member Function Documentation

◆ onCancel()

void onCancel ( )
overrideprotectedvirtual

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

Implements Awaiter.

◆ 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.