std::unique_lock::try_lock_until

template< class Clock, class Duration >
bool try_lock_until( const std::chrono::time_point<Clock,Duration>& timeout_time );
(C++11 起)

尝试锁定关联互斥。阻塞直至抵达指定的 timeout_time 或获得锁,之先到来者。成功获得锁时返回 true ,否则返回 false 。可能阻塞长于直至抵达 timeout_time

等效地调用 mutex()->try_lock_until(timeout_time)

若无关联互斥或已锁定互斥则抛出 std::system_error

目录

参数

timeout_time - 要阻塞到的最大时间点

返回值

若成功获得得到互斥锁有权则为 true ,否则为 false

异常

示例

参阅

锁定关联互斥
(公开成员函数)
尝试锁定关联互斥,若互斥不可用则返回
(公开成员函数)
试图锁定关联的定时可锁 (TimedLockable) 互斥,若互斥在给定时长中不可用则返回
(公开成员函数)
解锁关联互斥
(公开成员函数)

版本历史

  • (当前 | 先前 2017年8月26日 (六) 09:14Fruderica讨论 | 贡献. . (1,474字节) (-1,330). . (撤销)
  • 当前 | 先前 2014年10月26日 (日) 18:11P12bot讨论 | 贡献 . . (2,804字节) (0). . (Fix some translations) (撤销)
  • 当前 | 先前 2013年7月2日 (二) 11:37P12bot讨论 | 贡献 . . (2,804字节) (-124). . (Use {{lc}}. Update links. Various fixes.) (撤销)
  • 当前 | 先前 2012年11月2日 (五) 17:43P12bot讨论 | 贡献 . . (2,928字节) (+361). . (r2.7.3) (机器人添加:de, en, es, fr, it, ja, pt, ru) (撤销)
  • 当前 | 先前 2012年10月27日 (六) 11:35P12讨论 | 贡献 . . (2,567字节) (0). . (1个修订: Translate from the English version) (撤销)
  • 当前 | 先前 2012年10月26日 (五) 06:00TranslationBot讨论 | 贡献. . (2,567字节) (-73). . (Translated from the English version using Google Translate) (撤销)
  • 当前 | 先前 2012年10月26日 (五) 03:32P12讨论 | 贡献 . . (2,640字节) (0). . (1个修订: Translate from the English version) (撤销)
  • 当前 | 先前) 2012年10月25日 (四) 12:00TranslationBot讨论 | 贡献. . (2,640字节) (+2,640). . (Translated from the English version using Google Translate)