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

std::scoped_lock::scoped_lock

explicit scoped_lock( MutexTypes&... m );

(1)

(since C++17)

scoped_lock( MutexTypes&... m, std::adopt_lock_t t );

(2)

(since C++17)

scoped_lock( const scoped_lock& ) = delete;

(3)

(since C++17)

获取给定互斥对象的所有权。m...

1%29sizeof...(MutexTypes) == 0什么都不做。否则,如果sizeof...(MutexTypes) == 1,有效地调用m.lock().否则,有效地打电话std::lock(m...)如果MutexTypes不是递归互斥,并且当前线程已经拥有相应的参数。m......

2%29获取互斥体的所有权m...而不试图锁定他们中的任何一个。除非当前线程拥有m......

3%29复制构造函数被删除。

如果mscoped_lock对象是。

参数

m

-

mutexes to acquire ownership of

t

-

tag parameter used to select non-locking version of the constructor

例外

1%29抛出由m.lock()

2%29

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

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

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com