SW Task Event Loop Framework v1.0.0
High-performance C++ asynchronous event loop framework with timer management and promise-based programming
Loading...
Searching...
No Matches
swt::TaskPromise< void > Class Reference

Specialized promise for void-returning coroutines. More...

#include <Task.h>

Collaboration diagram for swt::TaskPromise< void >:
Collaboration graph

Public Types

using Handle = std::coroutine_handle< TaskPromise< void > >
 

Public Member Functions

Task< void > get_return_object ()
 Create the Task<void> object for this promise.
 
std::suspend_always initial_suspend () noexcept
 Initial suspend behavior - always suspend to allow manual start.
 
auto final_suspend () noexcept
 Final suspend behavior with continuation chaining.
 
void return_void ()
 Handle void return from coroutine.
 
void unhandled_exception ()
 Handle unhandled exceptions in the coroutine.
 
void getResult ()
 Check for exceptions (void tasks have no return value)
 
bool isReady () const noexcept
 Check if the task has completed.
 
void addContinuation (std::coroutine_handle<> continuation)
 Add a continuation to be resumed when task completes.
 

Detailed Description

Specialized promise for void-returning coroutines.

This specialization handles coroutines that don't return a value, using co_return; or implicit return at the end of the coroutine.

Definition at line 172 of file Task.h.

Member Typedef Documentation

◆ Handle

using swt::TaskPromise< void >::Handle = std::coroutine_handle<TaskPromise<void> >

Definition at line 174 of file Task.h.

Member Function Documentation

◆ addContinuation()

void swt::TaskPromise< void >::addContinuation ( std::coroutine_handle<>  continuation)
inline

Add a continuation to be resumed when task completes.

Parameters
continuationCoroutine handle to resume

Definition at line 254 of file Task.h.

◆ final_suspend()

auto swt::TaskPromise< void >::final_suspend ( )
inlinenoexcept

Final suspend behavior with continuation chaining.

Returns
Custom awaiter that resumes all waiting continuations

Definition at line 194 of file Task.h.

◆ get_return_object()

Task< void > swt::TaskPromise< void >::get_return_object ( )
inline

Create the Task<void> object for this promise.

Returns
Task<void> object associated with this promise

Definition at line 471 of file Task.h.

◆ getResult()

void swt::TaskPromise< void >::getResult ( )
inline

Check for exceptions (void tasks have no return value)

Exceptions
std::exception_ptrif coroutine threw an exception

Definition at line 236 of file Task.h.

◆ initial_suspend()

std::suspend_always swt::TaskPromise< void >::initial_suspend ( )
inlinenoexcept

Initial suspend behavior - always suspend to allow manual start.

Returns
std::suspend_always to require manual task.start() call

Definition at line 186 of file Task.h.

◆ isReady()

bool swt::TaskPromise< void >::isReady ( ) const
inlinenoexcept

Check if the task has completed.

Returns
true if task completed (successfully or with exception)

Definition at line 246 of file Task.h.

◆ return_void()

void swt::TaskPromise< void >::return_void ( )
inline

Handle void return from coroutine.

Definition at line 220 of file Task.h.

◆ unhandled_exception()

void swt::TaskPromise< void >::unhandled_exception ( )
inline

Handle unhandled exceptions in the coroutine.

Definition at line 227 of file Task.h.


The documentation for this class was generated from the following file: