unique_lock::try_lock_until方法

不阻止,尝试获取关联的 mutex 的所有权。

template<class Clock, class Duration>
   bool try_lock_until(const chrono::time_point<Clock, Duration>& Abs_time);
bool try_lock_until(const xtime *Abs_time);

参数

  • Abs_time
    指定的阈值,在之后方法的时间点不再尝试获取 mutex的所有权。

返回值

true,如果方法成功获取 mutex的所有权;否则,false。

备注

如果存储的 mutex 指针是 null,具有 operation_not_permitted错误代码的方法引发 system_error

如果调用线程已拥有 mutex,具有 resource_deadlock_would_occur错误代码的方法引发 system_error

要求

**标头:**mutex

**命名空间:**std

请参见

参考

unique_lock选件类

<mutex>

time_point选件类