A one-to-many provider for a single value.
A BroadcastValueProvider can vend multiple ValueFuture objects. When the provider is resolved, all futures vended by it are completed with the same value.
This provider is multi-shot: after Resolve is called, new futures can be retrieved with Get to wait for the next Resolve event.
BroadcastValueProvider must resolve all futures it has vended before it is destroyed. OptionalBroadcastValueProvider, in contrast, supports cancelling its futures.
| T | The type of value to provide. |
Public Member Functions | |
| BroadcastValueProvider (BroadcastValueProvider &&other) noexcept | |
| BroadcastValueProvider & | operator= (BroadcastValueProvider &&other) noexcept |
| BroadcastValueProvider (const BroadcastValueProvider &)=delete | |
| BroadcastValueProvider & | operator= (const BroadcastValueProvider &)=delete |
| ValueFuture< T > | Get () |
| template<typename U = T, std::enable_if_t<!std::is_void_v< U >, int > = 0> | |
| void | Resolve (const U &value) |
Resolves every pending ValueFuture with a copy of the provided value. | |
| template<typename U = T, std::enable_if_t< std::is_void_v< U >, int > = 0> | |
| void | Resolve () |
Resolves every pending ValueFuture. | |
|
inline |
Returns a ValueFuture that will be completed when Resolve is called.
Multiple futures can be retrieved and will pend concurrently.