std::recursive_timed_mutex::try_lock
STD::递归[医]定时[医]互斥::尝试[医]锁
bool try_lock( | | (since C++11) |
---|
试图锁定互斥体。马上回来。关于成功锁定获取返回true
,否则返回false
...
此函数允许伪造失败并返回。false
即使互斥锁目前没有被任何其他线程锁定。
线程可以调用try_lock
在递归互斥体上重复。成功呼叫try_lock
递增ownsership计数:只有在线程进行匹配次数的调用之后,互斥锁才会释放。unlock
...
所有权的最大级别未指定。打电话给try_lock
会回来false
如果超过此数字。
优先unlock()
对同一个互斥体的操作同步性
中定义的28名ASstd::memory_order
%29如果返回此操作true
.注意到以前lock()
如果此操作返回,则不与其同步。false
...
参数
%280%29
返回值
true
如果成功获取锁,则为false
...
例外
%280%29
例
另见
lock | locks the mutex, blocks if the mutex is not available (public member function) |
---|---|
try_lock_for | tries to lock the mutex, returns if the mutex has beenunavailable for the specified timeout duration (public member function) |
try_lock_until | tries to lock the mutex, returns if the mutex has beenunavailable until specified time point has been reached (public member function) |
unlock | unlocks the mutex (public member function) |
c MTX文件[医]幽会
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。