首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::shared_timed_mutex::try_lock_shared_until

template< class Clock, class Duration > bool try_lock_shared_until( const std::chrono::time_point<Clock,Duration>& timeout_time );

?

(since C++14)

尝试将互斥锁在共享模式下。块,直到指定timeout_time已到达或已获得锁,两者以第一位为准。关于成功锁定获取返回true,否则返回false...

如果timeout_time已传递,此函数的行为如下try_lock_shared()...

钟系在timeout_time使用,这意味着考虑到时钟的调整。因此,块的最大持续时间可能小于或超过timeout_time - Clock::now()在呼叫时,取决于调整的方向。该函数也可能阻塞时间超过之后。timeout_time由于调度或资源争用延迟已到达。

和...一样try_lock_shared(),则允许此函数伪造失败并返回。false即使互斥锁之前没有被任何其他线程锁定。timeout_time...

优先unlock()对同一个互斥体的操作同步性中定义的28名ASstd::memory_order%29如果返回此操作true...

如果try_lock_shared_until由已经拥有mutex在任何模式%28共享或独占%29中,行为都是未定义的。

参数

timeout_time

-

maximum time point to block until

返回值

true如果已成功获取共享锁所有权,则为false...

例外

任何由时钟、时间引发的异常[医]在执行%28时钟、时间点和标准库提供的持续时间期间,不要抛出%29。

另见

try_lock_until

tries to lock the mutex, returns if the mutex has beenunavailable until specified time point has been reached (public member function)

try_lock_shared

tries to lock the mutex for shared ownership, returns if the mutex is not available (public member function)

try_lock_shared_for

tries to lock the mutex for shared ownership, returns if the mutex has beenunavailable for the specified timeout duration (public member function)

代码语言:txt
复制
 ? cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com