ldas-tools-al  2.6.6
Classes | Public Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
LDASTools::AL::ReadWriteLock::baton_type Class Reference

Manager of the read/write lock resource. More...

#include <ReadWriteLock.hh>

Classes

class  impl
 

Public Member Functions

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

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)
 
void * ReadWriteLockBatonHandle (ReadWriteLock::baton_type Baton)
 

Detailed Description

Manager of the read/write lock resource.

Constructor & Destructor Documentation

◆ baton_type() [1/3]

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/3]

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() [3/3]

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/3]

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/3]

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() [3/3]

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/9]

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() [2/9]

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() [3/9]

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() [4/9]

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() [5/9]

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() [6/9]

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
...
}

◆ Lock() [7/9]

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() [8/9]

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() [9/9]

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/3]

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

Destroy the resources associated with this instance.

◆ reset() [2/3]

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

Destroy the resources associated with this instance.

◆ reset() [3/3]

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

Destroy the resources associated with this instance.

◆ TryLock() [1/3]

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.

◆ TryLock() [2/3]

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() [3/3]

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/3]

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/3]

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() [3/3]

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 Function Documentation

◆ ReadWriteLockBatonHandle [1/3]

void* ReadWriteLockBatonHandle ( ReadWriteLock::baton_type  Baton)
friend

◆ ReadWriteLockBatonHandle [2/3]

void* ReadWriteLockBatonHandle ( ReadWriteLock::baton_type  Baton)
friend

◆ ReadWriteLockBatonHandle [3/3]

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: