FutureCore provides common functionality for futures that need to be wakeable and stored in a list.
This class provides the core mechanism for:
Waker to be woken up.IntrusiveList.It is designed to be used as a member of a concrete future class (composition) rather than a base class, to simplify move semantics and object lifetime.
Public Types | |
| enum | ReadyForCompletion { kReadyForCompletion } |
| enum | Pending { kPending } |
Tag type to construct an active FutureCore. Pend may be called. | |
Public Member Functions | |
| FutureCore (FutureCore &&other) noexcept | |
| FutureCore & | operator= (FutureCore &&other) noexcept |
| constexpr | FutureCore (Pending) |
| constexpr | FutureCore (ReadyForCompletion) |
| FutureCore (const FutureCore &)=delete | |
| FutureCore & | operator= (const FutureCore &)=delete |
| bool | is_pendable () const |
| bool | is_complete () const |
| bool | is_ready () const |
| void | Wake () |
| void | WakeAndMarkReady () |
| void | Unlist () |
| Removes this future from its list, if it is in one. | |
| template<typename FutureType > | |
| auto | DoPend (FutureType &future, Context &cx) |
| bool | in_list () const |
Friends | |
| class | BaseFutureList |
Additional Inherited Members | |
Protected Member Functions inherited from pw::IntrusiveForwardList< T >::Item | |
| constexpr | Item ()=default |
Tag type to construct a FutureCore for which the next call to Pend will return Ready.
|
inlineexplicitconstexpr |
Constructs a pending FutureCore that represents an async operation. Pend must be called until it returns Ready.
A pending FutureCore must be tracked by its provider (e.g. in a FutureList).
|
inlineexplicitconstexpr |
Creates a wakeable future that is ready for completion. The next call to Pend must return Ready.
|
inline |
|
inline |
Pend() returned Ready.
|
inline |
Pend() function can be called.
|
inline |
true if the next Pend() call is guaranteed to return Ready. Depending on the implementation, Pend() may return Ready while is_ready is false. Future implementations call WakeAndMarkReady to set is_ready to true.
|
inline |
Wakes the task waiting on the future, if any. The future must be pended in order to make progress.
|
inline |
Wakes the task pending the future and sets is_ready to true. Only call this if the next call to to the future's Pend() will return Ready.