template<typename T, typename FutureType>
class pw::async2::ValueListProvider< T, FutureType >
A general purpose, multi-consumer provider that manages a list of pending futures.
ValueListProvider allows multiple distinct tasks (potentially running on different dispatchers) to register futures in a list. The provider owner can inspect, conditionally resolve, or bulk-abort pending futures from anywhere in the list.
- Template Parameters
-
| T | The type of value provided by the futures. |
| FutureType | The type of future vended, defaulting to ValueFuture<T>. |
|
|
| ValueListProvider (ValueListProvider &&other) noexcept |
| |
|
ValueListProvider & | operator= (ValueListProvider &&other) noexcept |
| |
|
| ValueListProvider (const ValueListProvider &)=delete |
| |
|
ValueListProvider & | operator= (const ValueListProvider &)=delete |
| |
|
template<typename... Args> |
| FutureType | Get (Args &&... args) |
| | Vends a future and automatically registers it in the pending list.
|
| |
|
bool | empty () const |
| | Returns true if the list contains no pending futures.
|
| |
|
size_t | size () const |
| | Returns the number of pending futures.
|
| |
|
template<typename... Args, typename U = T, std::enable_if_t<!std::is_void_v< U >, int > = 0> |
| void | ResolveFirst (Args &&... args) |
| | Resolves the first (oldest) pending future in the list.
|
| |
|
template<typename U = T, std::enable_if_t< std::is_void_v< U >, int > = 0> |
| void | ResolveFirst () |
| | Resolves the first (oldest) pending future in the list.
|
| |
| template<typename F > |
| bool | ResolveFirstMatching (F &&callback) |
| |
| template<typename F > |
| size_t | ResolveAllMatching (F &&callback) |
| |
|
template<typename F > |
| void | ResolveAll (F &&callback) |
| | Bulk-resolves all pending futures in the list.
|
| |