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

#include <util_concurrency.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: C++11 replace this by a type alias to RAII

Definition at line 104 of file util_concurrency.h.

Constructor & Destructor Documentation

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

Definition at line 106 of file util_concurrency.h.


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