HPX - High Performance ParalleX

PrevUpHomeNext

Function template when_any

hpx::when_any

Synopsis

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


template<typename... T> 
  future< when_any_result< tuple< future< T >...> > > 
  when_any(T &&... 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] An arbitrary number of future or shared_future objects, possibly holding different types 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<tuple<future<T0>, future<T1>...>>>: If inputs are fixed in number and are of heterogeneous types. The inputs can be any arbitrary number of future objects.

  • future<when_any_result<tuple<>>> if when_any is called with zero arguments. The returned future will be initially ready.


PrevUpHomeNext