std::shared_future<T>::wait_for (3) - Linux Man Pages
template< class Rep, class Period > (since C++11)
std::future_status wait_for( const std::chrono::duration<Rep,Period>& timeout_duration ) const;
Waits for the result to become available. Blocks until specified timeout_duration has elapsed or the result becomes available, whichever comes first. Returns value identifies the state of the result.
This function may block for longer than timeout_duration due to scheduling or resource contention delays.
The standard recommends that a steady clock is used to measure the duration. If an implementation uses a system clock instead, the wait time may also be sensitive to clock adjustments.
The behavior is undefined if valid()== false before the call to this function.
timeout_duration - maximum duration to block for
future_status::deferred The function to calculate the result has not been started yet
future_status::ready The result is ready
future_status::timeout The timeout has expired
Any exception thrown by clock, time_point, or duration during the execution (clocks, time points, and durations provided by the standard library never throw)
The implementations are encouraged to detect the case when valid == false before the call and throw a future_error with an error condition of future_errc::no_state.
// Run this code
wait (public member function)
wait_until (public member function)