首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::shared_future::wait_until

template< class Clock, class Duration > std::future_status wait_until( const std::chrono::time_point<Clock,Duration>& timeout_time ) const;

?

(since C++11)

wait_until等待结果可用。它阻塞直到指定。timeout_time已达到或结果可用,以第一位为准。返回值指示为什么wait_until回来了。

如果valid()== false在调用此函数之前。

参数

timeout_time

-

maximum time point to block until

返回值

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

例外

任何由时钟、时间引发的异常[医]在执行%28时钟、时间点和标准库提供的持续时间期间,不要抛出%29。

注记

鼓励实现在下列情况下检测情况:valid == false在呼叫前抛出一个future_error错误条件为future_errc::no_state...

钟系在timeout_time使用,这不需要是一个单调的时钟。如果时钟不连续地调整,则不能保证此函数的行为,但是现有的实现转换。timeout_timeClockstd::chrono::system_clock并委派给POSIX螺纹[医]康德[医]等待时间这样,等待就会尊重系统时钟,而不会尊重用户提供的时钟。Clock在任何情况下,该功能也可能等待更长的时间。timeout_time由于调度或资源争用延迟已到达。

另见

wait

waits for the result to become available (public member function)

wait_for

waits for the result, returns if it is not available for the specified timeout duration (public member function)

代码语言:txt
复制
 ? cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com