Class Index Cross Index Namespace Index

Class MutexLock


Contained in: global
Derived from: none
Derived by: none

#include "general/mutexlock.hh"


public function member index:

MutexLock(lock_type& mutex, const char* const File = "", const unsigned int Line = 0, bool Logging = true); Constructor
MutexLock(lock_type* const mutex_ptr, const char* const File = "", const unsigned int Line = 0, bool Logging = true); Constructor
~MutexLock(); Destructor
inline static void Destroy(lock_type& Lock);
inline static lock_type Initialize();
inline static void Initialize(lock_type& Lock);
inline static void Lock(lock_type& Lock);
void Release(const char* const File = "", const unsigned int Line = 0); Release the lock before object is destructed
inline static void UnLock(lock_type& Lock);
 

private function member index:

MutexLock(); Default Constructor
MutexLock(const MutexLock&); Copy Constructor
const MutexLock& operator =(const MutexLock&); Assigment operator
 

Description:

class MutexLock This class ensures that the given mutex is unlocked whenever an exception is thrown but not caught in a locked section. It should be used like this: { MutexLock lock(pthread_mutex_t& mutex); // mutex is now locked do whatever... ... } // MutexLock has been destructed so mutex is now unlocked Creating two MutexLock objects with the same mutex in the same scope will cause a deadlock.


Function Member Descriptions:


MutexLock::MutexLock - Constructor


MutexLock(lock_type& mutex, const char* const File = "", const unsigned int Line = 0, bool Logging = true);



MutexLock::MutexLock - Constructor


MutexLock(lock_type* const mutex_ptr, const char* const File = "", const unsigned int Line = 0, bool Logging = true);



MutexLock::MutexLock - Default Constructor


MutexLock();
Default constructor is private to prevent copying of classes internal data.




MutexLock::MutexLock - Copy Constructor


MutexLock(const MutexLock&);
Copy constructor is private to prevent copying of classes internal data.




MutexLock::~MutexLock - Destructor


~MutexLock();



MutexLock::Destroy


inline static void Destroy(lock_type& Lock);



MutexLock::Initialize


inline static lock_type Initialize();



MutexLock::Initialize


inline static void Initialize(lock_type& Lock);



MutexLock::Lock


inline static void Lock(lock_type& Lock);



MutexLock::Release - Release the lock before object is destructed


void Release(const char* const File = "", const unsigned int Line = 0);



MutexLock::UnLock


inline static void UnLock(lock_type& Lock);



MutexLock::operator = - Assigment operator


const MutexLock& operator =(const MutexLock&);
Assignment operator is privat to prevent copying of classes internal data




Variable Member Descriptions:


MutexLock::m_logging -

bool m_logging;

MutexLock::m_mutex_ptr - Mutex lock to prevent multiple access to critical sections of code.

lock_type* m_mutex_ptr;