hpx::wait_all_for#
Defined in header hpx/future.hpp.
See Public API for a list of names and headers that are part of the public HPX API.
See also:
-
template<typename InputIter>
hpx::future_status hpx::wait_all_for(hpx::chrono::steady_duration const &timeout, InputIter first, InputIter last)# The function wait_all_for is an operator allowing to join on the result of all given futures, similar to wait_all. It differs from wait_all in that it will not suspend indefinitely if one or more of the given futures never become ready; instead it returns as soon as either all futures have become ready, or the given timeout has elapsed, whichever happens first.
Note
The function wait_all_for returns after all futures have become ready, or after the given timeout has expired, whichever comes first. All input futures are still valid after wait_all_for returns, independently of the returned status, and can be inspected (e.g. using is_ready()) to determine which of the given futures have become ready.
Note
The function wait_all_for will rethrow any exceptions captured by the futures while becoming ready, as long as all the given futures became ready before the timeout elapsed. If this behavior is undesirable, use wait_all_for_nothrow instead.
- Parameters:
timeout – The maximum duration to wait for all the given futures to become ready.
first – The iterator pointing to the first element of a sequence of future or shared_future objects for which wait_all_for should wait.
last – The iterator pointing to the element after the last one of a sequence of future or shared_future objects for which wait_all_for should wait.
- Returns:
Returns hpx::future_status::ready if all the given futures have become ready before timeout has elapsed, and hpx::future_status::timeout otherwise.
-
template<typename R>
hpx::future_status hpx::wait_all_for(hpx::chrono::steady_duration const &timeout, std::vector<future<R>> const &futures)# The function wait_all_for is an operator allowing to join on the result of all given futures, similar to wait_all. It differs from wait_all in that it will not suspend indefinitely if one or more of the given futures never become ready; instead it returns as soon as either all futures have become ready, or the given timeout has elapsed, whichever happens first.
Note
The function wait_all_for returns after all futures have become ready, or after the given timeout has expired, whichever comes first. All input futures are still valid after wait_all_for returns, independently of the returned status, and can be inspected (e.g. using is_ready()) to determine which of the given futures have become ready.
Note
The function wait_all_for will rethrow any exceptions captured by the futures while becoming ready, as long as all the given futures became ready before the timeout elapsed. If this behavior is undesirable, use wait_all_for_nothrow instead.
Note
The function wait_all_for returns after all futures have become ready, or after the given timeout has expired, whichever comes first. All input futures are still valid after wait_all_for returns, independently of the returned status, and can be inspected (e.g. using is_ready()) to determine which of the given futures have become ready.
Note
The caller is responsible for keeping the futures container itself (and, for the iterator-range overload, the underlying sequence) alive, unmoved, and unmodified until it is done inspecting the futures’ state. If the timeout expires before all futures become ready, wait_all_for may leave asynchronous continuations attached to the not-yet-ready futures; destroying, moving, or reallocating the container before those futures settle results in undefined behavior.
- Parameters:
timeout – The maximum duration to wait for all the given futures to become ready.
futures – A vector or array holding an arbitrary amount of future or shared_future objects for which wait_all_for should wait.
- Returns:
Returns hpx::future_status::ready if all the given futures have become ready before timeout has elapsed, and hpx::future_status::timeout otherwise.
-
template<typename R, std::size_t N>
hpx::future_status hpx::wait_all_for(hpx::chrono::steady_duration const &timeout, std::array<future<R>, N> const &futures)# The function wait_all_for is an operator allowing to join on the result of all given futures, similar to wait_all. It differs from wait_all in that it will not suspend indefinitely if one or more of the given futures never become ready; instead it returns as soon as either all futures have become ready, or the given timeout has elapsed, whichever happens first.
Note
The function wait_all_for returns after all futures have become ready, or after the given timeout has expired, whichever comes first. All input futures are still valid after wait_all_for returns, independently of the returned status, and can be inspected (e.g. using is_ready()) to determine which of the given futures have become ready.
Note
The function wait_all_for will rethrow any exceptions captured by the futures while becoming ready, as long as all the given futures became ready before the timeout elapsed. If this behavior is undesirable, use wait_all_for_nothrow instead.
Note
The function wait_all_for returns after all futures have become ready, or after the given timeout has expired, whichever comes first. All input futures are still valid after wait_all_for returns, independently of the returned status, and can be inspected (e.g. using is_ready()) to determine which of the given futures have become ready.
Note
The caller is responsible for keeping the futures container itself (and, for the iterator-range overload, the underlying sequence) alive, unmoved, and unmodified until it is done inspecting the futures’ state. If the timeout expires before all futures become ready, wait_all_for may leave asynchronous continuations attached to the not-yet-ready futures; destroying, moving, or reallocating the container before those futures settle results in undefined behavior.
- Parameters:
timeout – The maximum duration to wait for all the given futures to become ready.
futures – A vector or array holding an arbitrary amount of future or shared_future objects for which wait_all_for should wait.
- Returns:
Returns hpx::future_status::ready if all the given futures have become ready before timeout has elapsed, and hpx::future_status::timeout otherwise.
-
template<typename T>
hpx::future_status hpx::wait_all_for(hpx::chrono::steady_duration const &timeout, hpx::future<T> const &f)# The function wait_all_for is an operator allowing to join on the result of the given future, similar to wait_all. It differs from wait_all in that it will not suspend indefinitely if the given future never becomes ready; instead it returns as soon as either the future has become ready, or the given timeout has elapsed, whichever happens first.
Note
The function wait_all_for returns after the future has become ready, or after the given timeout has expired, whichever comes first. The input future is still valid after wait_all_for returns, independently of the returned status.
Note
The function wait_all_for will rethrow any exceptions captured by the future while becoming ready, as long as the given future became ready before the timeout elapsed. If this behavior is undesirable, use wait_all_for_nothrow instead.
- Parameters:
timeout – The maximum duration to wait for the given future to become ready.
f – A future or shared_future for which wait_all_for should wait.
- Returns:
Returns hpx::future_status::ready if the given future has become ready before timeout has elapsed, and hpx::future_status::timeout otherwise.
-
template<typename ...T>
hpx::future_status hpx::wait_all_for(hpx::chrono::steady_duration const &timeout, T const&... futures)# The function wait_all_for is an operator allowing to join on the result of all given futures, similar to wait_all. It differs from wait_all in that it will not suspend indefinitely if one or more of the given futures never become ready; instead it returns as soon as either all futures have become ready, or the given timeout has elapsed, whichever happens first.
Note
The function wait_all_for returns after all futures have become ready, or after the given timeout has expired, whichever comes first. All input futures are still valid after wait_all_for returns, independently of the returned status, and can be inspected (e.g. using is_ready()) to determine which of the given futures have become ready.
Note
The function wait_all_for will rethrow any exceptions captured by the futures while becoming ready, as long as all the given futures became ready before the timeout elapsed. If this behavior is undesirable, use wait_all_for_nothrow instead.
- Parameters:
timeout – The maximum duration to wait for all the given futures to become ready.
futures – An arbitrary number of future or shared_future objects, possibly holding different types for which wait_all_for should wait.
- Returns:
Returns hpx::future_status::ready if all the given futures have become ready before timeout has elapsed, and hpx::future_status::timeout otherwise.