|
uvco 0.1
|
#include <promise_core.h>

Public Member Functions | |
| PromiseCore ()=default | |
| PromiseCore (const PromiseCore &)=delete | |
| PromiseCore (PromiseCore &&)=delete | |
| PromiseCore & | operator= (const PromiseCore &)=delete |
| PromiseCore & | operator= (PromiseCore &&)=delete |
| virtual | ~PromiseCore ()=default |
| PromiseCore (T &&value) | |
| virtual void | setHandle (std::coroutine_handle<> handle) |
| Set the coroutine to be resumed once a result is ready. | |
| void | setRunning (std::coroutine_handle<> handle) |
| Used by Coroutine<T> to set the producing coroutine handle. | |
| void | resetHandle () |
| bool | isAwaited () |
| Checks if a coroutine is waiting on a promise belonging to this core. | |
| bool | ready () const |
| Checks if a value is present in the slot. | |
| bool | stale () const |
| void | resume () |
| void | destroyCoroutine () |
| void | except (const std::exception_ptr &exc) |
Public Attributes | |
| std::optional< std::variant< T, std::exception_ptr > > | slot |
| The slot contains the result once obtained. | |
Protected Attributes | |
| std::coroutine_handle | coroutine_ |
| std::coroutine_handle | waitingHandle_ |
| PromiseState | state_ = PromiseState::init |
A PromiseCore is part of the Coroutine<T> frame; a reference to it is held by the Promise referring to the coroutine.
|
default |
|
delete |
|
delete |
|
virtualdefault |
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
Checks if a coroutine is waiting on a promise belonging to this core.
|
delete |
|
delete |
|
inlinenodiscard |
Checks if a value is present in the slot.
|
inline |
Reset the handle, so that the coroutine is not resumed anymore. This is required for SelectSet.
|
inline |
Resume a suspended coroutine waiting on the associated coroutine by enqueuing it in the global event loop.
A promise core can only be resumed once.
|
inlinevirtual |
Set the coroutine to be resumed once a result is ready.
Reimplemented in uvco::MultiPromiseCore< T >.
|
inline |
Used by Coroutine<T> to set the producing coroutine handle.
|
inlinenodiscard |
Returns true if the promise has completed, and its results have been fetched.
|
protected |
Set to the coroutine producing this promise. Used to destroy it after completion or when the associated Promise is dropped.
| std::optional<std::variant<T, std::exception_ptr> > uvco::PromiseCore< T >::slot |
The slot contains the result once obtained.
|
protected |
|
protected |
Set to the coroutine awaiting this promise if state_ == awaitedOn. May be nullptr.