Wait until the asynchronous result associated with an instance of std::future
is ready, or until a specified time period has elapsed.
template<typename Clock,typename Duration> future_status wait_until(std::chrono::time_point<Clock,Duration> const& absolute_time);
- Preconditions:
this->valid()would returntrue.- Effects:
If the asynchronous result associated with
*thiscontains a deferred function arising from a call tostd::asyncthat has not yet started execution, returns immediately without blocking. Otherwise blocks until the asynchronous result associated with*thisis ready orClock::now()returns a time equal to or later thanabsolute_time.- Returns:
std::future_status::deferredif the asynchronous result associated with*thiscontains a deferred function arising from a call tostd::asyncthat has not yet started execution,std::future_status::readyif the asynchronous result associated with*thisis ready,std::future_status::timeoutifClock::now()returns a time equal to or later thanabsolute_time.- Note:
There is no guarantee as to how long the calling thread will be blocked for, only that if the function returns
std::future_status::timeoutthenClock::now()returned a time equal to or later thanabsolute_timeat the point at which the thread became unblocked.- Throws:
Nothing.
Header
#include <future>