Function future_select

poet::future_select — construct a future from the first complete future of a group.

Synopsis

template<typename T> 
  future<T> future_select(const future<T> & f1, const future<T> & f2);
template<typename T> 
  future<T> future_select(const future<T> & f1, const future<T> & f2, ..., 
                          const future<T> & fN);

Description

The future_select function constructs a future which can be used to wait on a group of futures until any one is ready (or has an exception).

By default, overloads which accept 2 to 10 future arguments are provided. The user may obtain more or fewer overloads by defining the macro POET_FUTURE_SELECT_MAX_ARGS prior to including poet/future_select.hpp.

See also

  • future_select_range: Same as future_select except it takes iterators to a range of futures as its parameters.

  • future_selector: Efficiently perform repeated waits on a group of futures, waiting for the next future to become ready.

  • future_barrier: construct a future which becomes ready when all of a group of futures are ready or one has an exception.

Returns:

A future which becomes ready when any one of the input futures either become ready or has an exception. The returned future will receive the value/exception of the input future which became ready (or has an exception).