public member function
<future>
std::future::wait_until
template <class Clock, class Duration>
future_status wait_until (const chrono::time_point<Clock,Duration>& abs_time) const;
Wait for ready until time point
Waits for the shared state to be ready, at most until abs_time.
If the shared state is not yet ready (i.e., the provider has not yet set its value or exception), the function blocks the calling thread and waits until it is ready or until abs_time, whichever comes first.
When the function returns because its shared state is made ready, the value or exception set on the shared state is nor read, but all visible side effects are synchronized between the point the provider makes the shared state ready and the return of this function.
If the shared state contains a deferred function (such as future objects returned by async), the function does not block, returning immediately with a value of future_status::deferred.
Parameters
- abs_time
- A point in time when the function will be forced to return, resuming execution of the calling thread.
Note that multi-threading management operations may cause certain delays beyond this.
time_point is an object that represents a specific absolute time.
Return value
A value of type future_status indicating what caused the function to return:
Data races
The future object is accessed.
The shared state is accessed as an atomic operation (causing no data races).
Exception safety
Calling this member function on a future object that is not valid, produces undefined behavior (although library implementations may detect this and throw future_error with a no_state error condition, offering a strong guarantee).
It may throw if an operation related to abs_time throws (note that operations on the standard clock and duration types provided in <chrono>
never throw).