hpx/async_combinators/wait_any.hpp#

See Public API for a list of names and headers that are part of the public HPX API.

namespace hpx

Top level HPX namespace.

Functions

template<typename InputIter>
void wait_any(InputIter first, InputIter last)#

The function wait_any is a non-deterministic choice operator. It OR-composes all future objects given and returns after one future of that list finishes execution.

Note

The function wait_any returns after at least one future has become ready. All input futures are still valid after wait_any returns.

Note

The function wait_any will rethrow any exceptions captured by the futures while becoming ready. If this behavior is undesirable, use wait_any_nothrow instead.

Parameters
  • first – [in] The iterator pointing to the first element of a sequence of future or shared_future objects for which wait_any should wait.

  • last – [in] The iterator pointing to the last element of a sequence of future or shared_future objects for which wait_any should wait.

template<typename R>
void wait_any(std::vector<future<R>> &futures)#

The function wait_any is a non-deterministic choice operator. It OR-composes all future objects given and returns after one future of that list finishes execution.

Note

The function wait_any returns after at least one future has become ready. All input futures are still valid after wait_any returns.

Note

The function wait_any will rethrow any exceptions captured by the futures while becoming ready. If this behavior is undesirable, use wait_any_nothrow instead.

Parameters

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

template<typename R, std::size_t N>
void wait_any(std::array<future<R>, N> &futures)#

The function wait_any is a non-deterministic choice operator. It OR-composes all future objects given and returns after one future of that list finishes execution.

Note

The function wait_any returns after at least one future has become ready. All input futures are still valid after wait_any returns.

Note

The function wait_any will rethrow any exceptions captured by the futures while becoming ready. If this behavior is undesirable, use wait_any_nothrow instead.

Parameters

futures – [in] Amn array holding an arbitrary amount of future or shared_future objects for which wait_any should wait.

template<typename ...T>
void wait_any(T&&... futures)#

The function wait_any is a non-deterministic choice operator. It OR-composes all future objects given and returns after one future of that list finishes execution.

Note

The function wait_any returns after at least one future has become ready. All input futures are still valid after wait_any returns.

Note

The function wait_any will rethrow any exceptions captured by the futures while becoming ready. If this behavior is undesirable, use wait_any_nothrow instead.

Parameters

futures – [in] An arbitrary number of future or shared_future objects, possibly holding different types for which wait_any should wait.

template<typename InputIter>
void wait_any_n(InputIter first, std::size_t count)#

The function wait_any_n is a non-deterministic choice operator. It OR-composes all future objects given and returns after one future of that list finishes execution.

Note

The function wait_any_n returns after at least one future has become ready. All input futures are still valid after wait_any_n returns.

Note

The function wait_any_n will rethrow any exceptions captured by the futures while becoming ready. If this behavior is undesirable, use wait_any_n_nothrow instead.

Parameters
  • first – [in] The iterator pointing to the first element of a sequence of future or shared_future objects for which wait_any_n should wait.

  • count – [in] The number of elements in the sequence starting at first.