std::future<T>::wait_until (3) - Linux Manuals
std::future<T>::wait_until: std::future<T>::wait_until
NAME
std::future<T>::wait_until - std::future<T>::wait_until
Synopsis
template< class Clock, class Duration > (since C++11)
std::future_status wait_until( const std::chrono::time_point<Clock,Duration>& timeout_time ) const;
wait_until waits for a result to become available. It blocks until specified timeout_time has been reached or the result becomes available, whichever comes first. The return value indicates why wait_until returned.
The behavior is undefined if valid()== false before the call to this function.
Parameters
timeout_time - maximum time point to block until
Return value
Constant Explanation
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
Exceptions
Any exception thrown by clock, time_point, or duration during the execution (clocks, time points, and durations provided by the standard library never throw)
Notes
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.
The clock tied to timeout_time is used, which is not required to be a monotonic clock.There are no guarantees regarding the behavior of this function if the clock is adjusted discontinuously, but the existing implementations convert timeout_time from Clock to std::chrono::system_clock and delegate to POSIX pthread_cond_timedwait so that the wait honors ajustments to the system clock, but not to the the user-provided Clock. In any case, the function also may wait for longer than until after timeout_time has been reached due to scheduling or resource contention delays.
Example
// Run this code