completion_future::wait_for 方法

阻止,直到关联的异步操作完成或由 _Rel_time 指定的时间过去为止。

template <
   class _Rep,
   class _Period
>
std::future_status::future_status wait_for(
   const std::chrono::duration<_Rep, _Period>& _Rel_time
) const;

参数

  • _Rep
    表达计时周期数的算法类型。

  • _Period
    表示每个滴答过程中过去的秒数的 std::ratio。

  • _Rel_time
    等待操作完成的最长时间。

返回值

返回:

  • 如果相关异步操作没有运行,则 std::future_status::deferred

  • 如果相关异步操作已完成,则 std::future_status::ready

  • 如果已运行指定的时间段,则 std::future_status::timeout

要求

**标头:**amprt.h

**命名空间:**并发

请参见

参考

completion_future 类