Valid states for a promise to be in:
Initially, init marks a newly constructed promise. Once a coroutine waits for its result, the promise transitions to waitedOn. At that point, the handle_ field contains a resume handle (of the waiter). Once the promise is ready and the caller is resumed, the state transitions to running. After the caller has been run (and suspended again), the state is finished, and no more operations may be executed on this promise.
| Enumerator |
|---|
| init | After construction, as the associated coroutine is about to start, up to the first suspension point and the following co_await.
|
| waitedOn | After the coroutine has reached a suspension point and another coroutine has started co_awaiting it.
|
| finished | A coroutine has returned the value and the promise is either ready to be resolved, or has already been resolved (ready() vs stale()).
|
31 {
41};
@ waitedOn
Definition promise_core.h:37
@ finished
Definition promise_core.h:40
@ init
Definition promise_core.h:34