CernVM-FS  2.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LockGuard< LockableT > Class Template Reference

#include <mutex.h>

Inheritance diagram for LockGuard< LockableT >:
Collaboration diagram for LockGuard< LockableT >:

Public Member Functions

 LockGuard (LockableT *object)
- Public Member Functions inherited from RAII< LockableT >
 RAII (LockableT &object)
 RAII (LockableT *object)
 ~RAII ()

Additional Inherited Members

- Protected Member Functions inherited from RAII< LockableT >
void Enter ()
void Leave ()

Detailed Description

template<typename LockableT>
class LockGuard< LockableT >

This is a simple scoped lock implementation. Every object that provides the methods Lock() and Unlock() should work with it. Classes that will be used with this template should therefore simply inherit from Lockable.

Creating a LockGuard object on the stack will lock the provided object. When the LockGuard runs out of scope it will automatically release the lock. This ensures a clean unlock in a lot of situations!

TODO(jblomer): C++11 replace this by a type alias to RAII

Definition at line 69 of file mutex.h.

Constructor & Destructor Documentation

template<typename LockableT>
LockGuard< LockableT >::LockGuard ( LockableT *  object)

Definition at line 71 of file mutex.h.

The documentation for this class was generated from the following file: