ldas-tools-al 2.6.7
 
Loading...
Searching...
No Matches
anonymous_namespace{ReadWriteLock.cc}::ReadWriteLock::baton_type Class Reference

#include <ReadWriteLock.hh>

Classes

class  impl
 

Public Member Functions

 baton_type (bool Logging=true)
 Constructor.
 
 baton_type (bool Logging=true)
 Constructor.
 
void * Handle ()
 Return pointer to low level data storage.
 
void * Handle ()
 Return pointer to low level data storage.
 
void Lock (mode_type Mode, const char *const File, const size_t Line)
 Request the resource to be locked.
 
void Lock (mode_type Mode, bool TryLock, const char *const File, const size_t Line)
 Request the resource to be locked.
 
void Lock (mode_type Mode, size_t Timeout, const char *const File, const size_t Line)
 Request the resource to be locked.
 
void Lock (mode_type Mode, const char *const File, const size_t Line)
 Request the resource to be locked.
 
void Lock (mode_type Mode, bool TryLock, const char *const File, const size_t Line)
 Request the resource to be locked.
 
void Lock (mode_type Mode, size_t Timeout, const char *const File, const size_t Line)
 Request the resource to be locked.
 
void TryLock (mode_type Mode, const char *const File, const size_t Line)
 Request the resource to be locked without waiting.
 
void TryLock (mode_type Mode, const char *const File, const size_t Line)
 Request the resource to be locked without waiting.
 
void Unlock (const char *const File, const size_t Line)
 Release any locks held on the resource.
 
void Unlock (const char *const File, const size_t Line)
 Release any locks held on the resource.
 
void reset ()
 Destroy the resources associated with this instance.
 
void reset ()
 Destroy the resources associated with this instance.
 

Private Attributes

boost::shared_ptr< implp
 

Static Private Attributes

static int retry_count_max = 10
 

Friends

void * ReadWriteLockBatonHandle (ReadWriteLock::baton_type Baton)
 
void * ReadWriteLockBatonHandle (ReadWriteLock::baton_type Baton)
 

Constructor & Destructor Documentation

◆ baton_type() [1/2]

LDASTools::AL::ReadWriteLock::baton_type::baton_type ( bool Logging = true)

Constructor.

Parameters
[in]LoggingIf true, then all actions associated with this instance will be logged for DeadLockDetector.

◆ baton_type() [2/2]

LDASTools::AL::ReadWriteLock::baton_type::baton_type ( bool Logging = true)

Constructor.

Parameters
[in]LoggingIf true, then all actions associated with this instance will be logged for DeadLockDetector.

Member Function Documentation

◆ Handle() [1/2]

void * LDASTools::AL::ReadWriteLock::baton_type::Handle ( )

Return pointer to low level data storage.

Returns
Pointer to low level data storage.
Note
This should be used very sparingly since the library used to implement this fuctionality may change.

◆ Handle() [2/2]

void * LDASTools::AL::ReadWriteLock::baton_type::Handle ( )

Return pointer to low level data storage.

Returns
Pointer to low level data storage.
Note
This should be used very sparingly since the library used to implement this fuctionality may change.

◆ Lock() [1/6]

void LDASTools::AL::ReadWriteLock::baton_type::Lock ( mode_type Mode,
bool TryLock,
const char *const File,
const size_t Line )

Request the resource to be locked.

Parameters
[in]ModeAny of the lock_modes.
[in]TryLockIf true, then return immediately wether or not the lock was obtained.
[in]FileThe filename from where the call was made.
[in]LineThe line number from where the call was made.
try {
l.Lock( ReadWriteLock::READ, true, __FILE__, __LINE__ );
}
catch( const ReadWrieLock::BusyError& Exception )
{
// Do something since the lock could not be acquired
...
}
catch( const ReadWrieLock::DeadLockError& Exception )
{
// Do something since the lock could not be acquired
...
}
@ READ
< Initial mode
Definition ReadWriteLock.hh:151

◆ Lock() [2/6]

void LDASTools::AL::ReadWriteLock::baton_type::Lock ( mode_type Mode,
bool TryLock,
const char *const File,
const size_t Line )

Request the resource to be locked.

Parameters
[in]ModeAny of the lock_modes.
[in]TryLockIf true, then return immediately wether or not the lock was obtained.
[in]FileThe filename from where the call was made.
[in]LineThe line number from where the call was made.

◆ Lock() [3/6]

void LDASTools::AL::ReadWriteLock::baton_type::Lock ( mode_type Mode,
const char *const File,
const size_t Line )
inline

Request the resource to be locked.

Parameters
[in]ModeAny of the lock_modes.
[in]FileThe filename from where the call was made.
[in]LineThe line number from where the call was made.
try {
l.Lock( ReadWriteLock::READ, __FILE__, __LINE__ );
}
catch( const ReadWriteLock::BusyError& Exception )
{
// Do something since the lock could not be acquired
...
}
catch( const ReadWriteLock::DeadLockError& Exception )
{
// Do something since the lock could not be acquired
...
}

◆ Lock() [4/6]

void LDASTools::AL::ReadWriteLock::baton_type::Lock ( mode_type Mode,
const char *const File,
const size_t Line )

Request the resource to be locked.

Parameters
[in]ModeAny of the lock_modes.
[in]FileThe filename from where the call was made.
[in]LineThe line number from where the call was made.

◆ Lock() [5/6]

void LDASTools::AL::ReadWriteLock::baton_type::Lock ( mode_type Mode,
size_t Timeout,
const char *const File,
const size_t Line )

Request the resource to be locked.

Parameters
[in]ModeAny of the lock_modes.
[in]TimeoutTime limit in seconds in which to acquire the lock. A value of zero (0) indicates that the method should wait until the lock is granted.
[in]FileThe filename from where the call was made.
[in]LineThe line number from where the call was made.

◆ Lock() [6/6]

void LDASTools::AL::ReadWriteLock::baton_type::Lock ( mode_type Mode,
size_t Timeout,
const char *const File,
const size_t Line )

Request the resource to be locked.

Parameters
[in]ModeAny of the lock_modes.
[in]TimeoutTime limit in seconds in which to acquire the lock. A value of zero (0) indicates that the method should wait until the lock is granted.
[in]FileThe filename from where the call was made.
[in]LineThe line number from where the call was made.

◆ reset() [1/2]

void LDASTools::AL::ReadWriteLock::baton_type::reset ( )
inline

Destroy the resources associated with this instance.

◆ reset() [2/2]

void LDASTools::AL::ReadWriteLock::baton_type::reset ( )

Destroy the resources associated with this instance.

◆ TryLock() [1/2]

void LDASTools::AL::ReadWriteLock::baton_type::TryLock ( mode_type Mode,
const char *const File,
const size_t Line )
inline

Request the resource to be locked without waiting.

Parameters
[in]ModeAny of the lock_modes.
[in]FileThe filename from where the call was made.
[in]LineThe line number from where the call was made.

The TryLock method tries to lock the resouce. If the resouce is locked prior to this call, then the method returns immediately by throwing the ReadWriteLock::BusyError exception.

try {
l.TryLock( ReadWriteLock::READ, __FILE__, __LINE__ );
}
catch( const ReadWriteLock::BusyError& Exception )
{
// Do something since the lock could not be acquired
...
}
catch( const ReadWriteLock::DeadLockError& Exception )
{
// Do something since the lock could not be acquired
...
}

◆ TryLock() [2/2]

void LDASTools::AL::ReadWriteLock::baton_type::TryLock ( mode_type Mode,
const char *const File,
const size_t Line )

Request the resource to be locked without waiting.

Parameters
[in]ModeAny of the lock_modes.
[in]FileThe filename from where the call was made.
[in]LineThe line number from where the call was made.

◆ Unlock() [1/2]

void LDASTools::AL::ReadWriteLock::baton_type::Unlock ( const char *const File,
const size_t Line )

Release any locks held on the resource.

Parameters
[in]FileThe filename from where the call was made.
[in]LineThe line number from where the call was made.

◆ Unlock() [2/2]

void LDASTools::AL::ReadWriteLock::baton_type::Unlock ( const char *const File,
const size_t Line )

Release any locks held on the resource.

Parameters
[in]FileThe filename from where the call was made.
[in]LineThe line number from where the call was made.

Friends And Related Symbol Documentation

◆ ReadWriteLockBatonHandle [1/2]

void * ReadWriteLockBatonHandle ( ReadWriteLock::baton_type Baton)
friend

◆ ReadWriteLockBatonHandle [2/2]

void * ReadWriteLockBatonHandle ( ReadWriteLock::baton_type Baton)
friend

Member Data Documentation

◆ p

boost::shared_ptr< impl > LDASTools::AL::ReadWriteLock::baton_type::p
private

◆ retry_count_max

static int LDASTools::AL::ReadWriteLock::baton_type::retry_count_max = 10
staticprivate

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