Standard pw_async2 future states. Used by FutureCore and may be used by custom future implementations.
|
| enum | Pending { kPending
} |
| | Tag for constructing an active future, for which Pend may be called.
|
| |
| enum | ReadyForCompletion { kReadyForCompletion
} |
| |
◆ ReadyForCompletion
Tag for constructing a future that is guaranteed to return Ready from the next Pend call.
◆ FutureState() [1/3]
| constexpr pw::async2::FutureState::FutureState |
( |
| ) |
|
|
inlineconstexpr |
Represents an empty future. The future does not yet represent an asynchronous operation and Pend may not be called.
◆ FutureState() [2/3]
Represents a future that is guaranteed to return Ready from the next Pend call. Use of the ReadyForCompletion" state is optional---future implementations may skip fromPendingtoComplete` if desired.
◆ FutureState() [3/3]
| constexpr pw::async2::FutureState::FutureState |
( |
FutureState && |
other | ) |
|
|
inlineconstexpr |
Move constructs a FutureState, leaving the other in its default constructed / empty state.
◆ is_complete()
| constexpr bool pw::async2::FutureState::is_complete |
( |
| ) |
const |
|
inlineconstexpr |
- Returns
- Whether
Pend() returned Ready.
◆ is_initialized()
| constexpr bool pw::async2::FutureState::is_initialized |
( |
| ) |
const |
|
inlineconstexpr |
- Returns
true if the future was NOT default constructed. The future either represents an active or completed asynchronous operation.
◆ is_pendable()
| constexpr bool pw::async2::FutureState::is_pendable |
( |
| ) |
const |
|
inlineconstexpr |
- Returns
- Whether the future's
Pend() function can be called.
◆ is_ready()
| constexpr bool pw::async2::FutureState::is_ready |
( |
| ) |
const |
|
inlineconstexpr |
- Returns
true if the next Pend() call is guaranteed to return Ready. Not all future implementations use the ready state; Pend() may return Ready even though is_ready is false.
is_ready() is not changed by calls to MarkComplete.
◆ MarkComplete()
| void pw::async2::FutureState::MarkComplete |
( |
| ) |
|
|
inline |
Indicates that the future has completed and cannot be pended again.
- Warning
MarkComplete() may only be called within a Pend() implementation when it will return Ready.
◆ MarkReady()
| void pw::async2::FutureState::MarkReady |
( |
| ) |
|
|
inline |
Indicates that the future is ready for completion. The next Pend() call must return Ready. Use of MarkReady() is optional; futures can return Ready and be completed while is_ready() is false.
- Warning
- Only call
MarkReady() when the future will no longer be accessed outside of Pend().
The documentation for this class was generated from the following file: