在不阻止的情况下尝试获取关联 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 所有权。
返回值
如果此方法成功获取 mutex 的所有权,则为 true;否则为 false。
备注
如果存储的 mutex 指针是 null,operation_not_permitted错误代码的方法引发。system_error
如果调用线程已拥有 mutex,出现 resource_deadlock_would_occur错误代码的方法引发 system_error。
要求
标头: mutex
命名空间: std