|
Task< T > | get_return_object () |
| Create the Task 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_value (T value) |
| Store the coroutine return value.
|
|
void | unhandled_exception () |
| Handle unhandled exceptions in the coroutine.
|
|
T | getResult () |
| Get the stored result 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.
|
|
template<typename T>
class swt::TaskPromise< T >
Promise type for coroutine-based Task implementation.
TaskPromise manages the coroutine state and provides continuation chaining for proper asynchronous execution. It handles result storage, exception propagation, and thread-safe continuation management.
- Template Parameters
-
T | The return type of the coroutine |
Key features:
- Thread-safe completion: Atomic flags and proper memory ordering
- Continuation chaining: Multiple coroutines can await the same task
- Exception safety: Proper exception propagation and resource cleanup
- Memory efficient: Minimal overhead with optimized storage
- Note
- This class is not intended for direct use - it's managed by Task<T>
Definition at line 45 of file Task.h.