std::shared_timed_mutex::try_lock_shared
STD::共享[医]定时[医]互斥::尝试[医]锁[医]共享
bool try_lock_shared( | | (since C++14) |
---|
尝试将互斥锁在共享模式下。马上回来。关于成功锁定获取返回true
,否则返回false
...
此函数允许伪造失败并返回。false
即使互斥锁不被任何其他线程单独锁定。
优先unlock()
对同一个互斥体的操作同步性
中定义的28名ASstd::memory_order
%29如果返回此操作true
...
如果调用线程已经在任何模式下拥有互斥对象,则该行为是未定义的。
参数
%280%29
返回值
true
如果成功获取锁,则为false
...
例外
%280%29
例
另见
lock | locks the mutex, blocks if the mutex is not available (public member function) |
---|---|
try_lock_shared | tries to lock the mutex for shared ownership, returns if the mutex is not available (public member function) |
unlock_shared | unlocks the mutex (shared ownership) (public member function) |
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。
http://en.cppreference.com/w/cpp/线程/Shared[医]定时[医]互斥/尝试[医]锁[医]共享