HPX - High Performance ParalleX

PrevUpHomeNext

Function template when_any

hpx::when_any

Synopsis

// In header: <hpx/lcos/when_any.hpp>


template<typename R> 
  future< when_any_result< std::vector< future< R > > > > 
  when_any(std::vector< future< R >> & futures);

Description

The function when_any is a non-deterministic choice operator. It OR-composes all future objects given and returns a new future object representing the same list of futures after one future of that list finishes execution.

Parameters:

futures

[in] A vector holding an arbitrary amount of future or shared_future objects for which when_any should wait.

Returns:

Returns a when_any_result holding the same list of futures as has been passed to when_any and an index pointing to a ready future.

  • future<when_any_result<vector<future<R>>>>: If the input cardinality is unknown at compile time and the futures are all of the same type. The order of the futures in the output vector will be the same as given by the input iterator.


PrevUpHomeNext