Function future_barrier

poet::future_barrier — construct a future which becomes ready when a group of futures are all ready.

Synopsis

template<typename T1, typename T2> 
  future<void> future_barrier(const future<T1> & f1, const future<T1> & f2);
template<typename T1, typename T2, ..., typename TN> 
  future<void> 
  future_barrier(const future<T1> & f1, const future<T2> & f2, ..., 
                 const future<TN> & fN);

Description

The future_barrier functions construct a future which can be used to wait on a group of futures until they are all ready (or one 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_BARRIER_MAX_ARGS prior to including poet/future_barrier.hpp.

See also

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

  • future_combining_barrier: A more flexible version of future_barrier which allows the user to create an arbitrary value/exception for the returned future based on the values/exception of the input futures.

  • future_select: construct a future which becomes ready when any of a group of futures is ready or has an exception.

Returns:

A future which becomes ready when all of the input futures either become ready or one has an exception. If one of the input futures has an exception, the returned future will receive the same exception.