ldas-tools-al 2.6.7
Loading...
Searching...
No Matches
LDASTools::AL::MutexLock Class Reference

Descibes an object which release a mutex lock. More...

#include <mutexlock.hh>

Classes

class  BusyError
 Alias for the system specific mutex type. More...

Public Member Functions

 MutexLock (baton_type Baton, const char *const File, const unsigned int Line)
 Constructor.
 ~MutexLock ()
 Destructor.
void Release (const char *const File, const unsigned int Line)
 Release the lock before object is destructed.
 MutexLock (baton_type Baton, const char *const File, const unsigned int Line)
 Constructor.
 ~MutexLock ()
 Destructor.
void Release (const char *const File, const unsigned int Line)
 Release the lock before object is destructed.

Static Public Member Functions

static baton_type Baton ()
 Create a baton that is appropriate for use with this class.
static void ThreadCancel (void *VLock, const char *File=__FILE__, const unsigned int Line=__LINE__)
 Handler for thead cancelation.
static baton_type Baton ()
 Create a baton that is appropriate for use with this class.
static void ThreadCancel (void *VLock, const char *File=__FILE__, const unsigned int Line=__LINE__)
 Handler for thead cancelation.

Detailed Description

Descibes an object which release a mutex lock.

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(baton); // mutex is now locked
do whatever...
...
} // MutexLock has been destructed so mutex is now unlocked
MutexLock(baton_type Baton, const char *const File, const unsigned int Line)
Constructor.
Definition mutexlock.cc:147

Creating two MutexLock objects with the same mutex in the same scope will cause a deadlock.

Constructor & Destructor Documentation

◆ MutexLock() [1/2]

LDASTools::AL::MutexLock::MutexLock ( baton_type Baton,
const char *const File,
const unsigned int Line )

Constructor.

Parameters
BatonThe object to provide lock syncronization.
FileThe from where the request was made.
LineThe line number from where the request was made.

This contructor creates an object to ensure the releasing of the exclusive lock once the object goes out of scope. The lock held by the object can be released early by calling the Release method.

autotoc_md0

See also
Release

◆ MutexLock() [2/2]

LDASTools::AL::MutexLock::MutexLock ( baton_type Baton,
const char *const File,
const unsigned int Line )

Constructor.

Parameters
BatonThe object to provide lock syncronization.
FileThe from where the request was made.
LineThe line number from where the request was made.

Member Function Documentation

◆ ThreadCancel() [1/2]

void LDASTools::AL::MutexLock::ThreadCancel ( void * VLock,
const char * File = __FILE__,
const unsigned int Line = __LINE__ )
static

Handler for thead cancelation.

Parameters
[in]VLockThe VLock is a pointer to a ReadWriteLock object that holds a lock.
[in]FileThe file where the request was made.
[in]LineThe line number from where the request was made.

This routine is used when a thread is canceled and the lock needs to be release. It is currently only written to support pthread_cancel_push().

◆ ThreadCancel() [2/2]

void LDASTools::AL::MutexLock::ThreadCancel ( void * VLock,
const char * File = __FILE__,
const unsigned int Line = __LINE__ )
static

Handler for thead cancelation.

Parameters
[in]VLockThe VLock is a pointer to a ReadWriteLock object that holds a lock.
[in]FileThe file where the request was made.
[in]LineThe line number from where the request was made.

The documentation for this class was generated from the following files:
  • /home/abuild/rpmbuild/BUILD/ldas-tools-al-2.6.7-build/ldas-tools-al-2.6.7/build/include/ldastoolsal/mutexlock.hh
  • /home/abuild/rpmbuild/BUILD/ldas-tools-al-2.6.7-build/ldas-tools-al-2.6.7/src/mutexlock.hh
  • /home/abuild/rpmbuild/BUILD/ldas-tools-al-2.6.7-build/ldas-tools-al-2.6.7/src/mutexlock.cc