CernVM-FS  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RAII< T, P > Class Template Reference

#include <util_concurrency.h>

Inheritance diagram for RAII< T, P >:
Collaboration diagram for RAII< T, P >:

Public Member Functions

 RAII (T &object)
 
 RAII (T *object)
 
 ~RAII ()
 

Protected Member Functions

void Enter ()
 
void Leave ()
 
template<>
void Enter ()
 
template<>
void Leave ()
 
template<>
void Enter ()
 
template<>
void Leave ()
 
template<>
void Enter ()
 
template<>
void Leave ()
 

Private Attributes

T & ref_
 

Additional Inherited Members

- Private Member Functions inherited from SingleCopy
 SingleCopy ()
 

Detailed Description

template<typename T, RAII_Polymorphism::T P = RAII_Polymorphism::None>
class RAII< T, P >

Basic template wrapper class for any kind of RAII-like behavior. The user is supposed to provide a template specialization of Enter() and Leave(). On creation of the RAII object it will call Enter() respectively Leave() on destruction. The gold standard example is a LockGard (see below).

Note: Resource Acquisition Is Initialization (Bjarne Stroustrup)

Definition at line 77 of file util_concurrency.h.

Constructor & Destructor Documentation

template<typename T, RAII_Polymorphism::T P = RAII_Polymorphism::None>
RAII< T, P >::RAII ( T &  object)
inlineexplicit

Definition at line 79 of file util_concurrency.h.

template<typename T, RAII_Polymorphism::T P = RAII_Polymorphism::None>
RAII< T, P >::RAII ( T *  object)
inlineexplicit

Definition at line 80 of file util_concurrency.h.

template<typename T, RAII_Polymorphism::T P = RAII_Polymorphism::None>
RAII< T, P >::~RAII ( )
inline

Definition at line 81 of file util_concurrency.h.

Member Function Documentation

template<typename T, RAII_Polymorphism::T P = RAII_Polymorphism::None>
void RAII< T, P >::Enter ( )
inlineprotected

Definition at line 84 of file util_concurrency.h.

template<>
void RAII< pthread_mutex_t >::Enter ( )
inlineprotected

Definition at line 111 of file util_concurrency.h.

template<>
void RAII< pthread_rwlock_t, RAII_Polymorphism::ReadLock >::Enter ( )
inlineprotected

Definition at line 119 of file util_concurrency.h.

template<>
void RAII< pthread_rwlock_t, RAII_Polymorphism::WriteLock >::Enter ( )
inlineprotected

Definition at line 129 of file util_concurrency.h.

template<typename T, RAII_Polymorphism::T P = RAII_Polymorphism::None>
void RAII< T, P >::Leave ( )
inlineprotected

Definition at line 85 of file util_concurrency.h.

template<>
void RAII< pthread_mutex_t >::Leave ( )
inlineprotected

Definition at line 113 of file util_concurrency.h.

template<>
void RAII< pthread_rwlock_t, RAII_Polymorphism::ReadLock >::Leave ( )
inlineprotected

Definition at line 124 of file util_concurrency.h.

template<>
void RAII< pthread_rwlock_t, RAII_Polymorphism::WriteLock >::Leave ( )
inlineprotected

Definition at line 134 of file util_concurrency.h.

Member Data Documentation

template<typename T, RAII_Polymorphism::T P = RAII_Polymorphism::None>
T& RAII< T, P >::ref_
private

Definition at line 88 of file util_concurrency.h.


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