Chinaunix首页 | 论坛 | 博客
  • 博客访问: 397282
  • 博文数量: 48
  • 博客积分: 1820
  • 博客等级: 上尉
  • 技术积分: 705
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-28 23:10
文章分类

全部博文(48)

文章存档

2012年(1)

2011年(12)

2010年(34)

2009年(1)

分类:

2010-04-14 17:29:37

boost::lock_guard

构造是获得锁,析构时候放弃锁 


boost::lock_guard is very simple: on construction it acquires ownership of the implementation of the Lockable concept supplied as the constructor parameter. On destruction, the ownership is released. This provides simple RAII-style locking of a Lockable object, to facilitate exception-safe locking and unlocking. In addition, the lock_guard(Lockable & m,boost::adopt_lock_t) constructor allows the boost::lock_guard object to take ownership of a lock already held by the current thread.

lock_guard(Lockable & m)
Effects:

Stores a reference to m. Invokes m.lock().

Throws:

Any exception thrown by the call to m.lock().

阅读(3122) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:收藏俩本分布式的书籍

给主人留下些什么吧!~~