List of all members.
Public Member Functions |
| ReadWriteLock (int lockStatus=0) |
| constructor
|
| ~ReadWriteLock () |
| deconstructor
|
void | lockRead (int increment=1) |
| locks for reading
|
void | lockWrite () |
| locks for writing
|
void | unlock () |
| unlocks a read or write protection
|
void | _unlock (int value) |
| unlocks a read or write protection depending on the given integer value
|
int | getLockStatus () const |
| returns the protection state
|
Private Member Functions |
| ReadWriteLock (const ReadWriteLock &) |
Private Attributes |
int | nrOfReaders |
int | status |
| nrOfReaders (>= 0)
|
bool | writeGelocked |
| state (-1 if object is in write mode, 0 if object is idle, else number of readers)
|
pthread_mutex_t | mAtomicOp |
pthread_mutex_t | mReadLock |
| critical section for realizing atomic operation blocks
|
pthread_mutex_t | mWriteLock |
| critical section for realizing the read lock
|
Constructor & Destructor Documentation
ito::ReadWriteLock::ReadWriteLock |
( |
int |
lockStatus = 0 | ) |
[inline] |
constructor
- Parameters:
-
int | lockStatus = 0, should normally be used with the default parameter, else: lockStatus: -1 writeLock, 0 no lock, >0 read lock with given number of readers |
Member Function Documentation
void ito::ReadWriteLock::_unlock |
( |
int |
value | ) |
[inline] |
unlocks a read or write protection depending on the given integer value
- Parameters:
-
int | value (-1 : unlocks write protection, >0 unlocks the given number of reading protections) |
int ito::ReadWriteLock::getLockStatus |
( |
| ) |
const [inline] |
returns the protection state
- Returns:
- -1 if object is in write mode, 0 if object is idle, else number of readers
void ito::ReadWriteLock::lockRead |
( |
int |
increment = 1 | ) |
[inline] |
locks for reading
locks this object for reading. This method waits until the object is not protected by any write operation and then locks it for reading. If other participants are already reading this object, the number of readers variable is just incremented
- Parameters:
-
int | increment, number of new readers |
void ito::ReadWriteLock::lockWrite |
( |
| ) |
[inline] |
locks for writing
locks this object for writing. This method waits until this object is in idle mode and then locks it for one single writing operation.
void ito::ReadWriteLock::unlock |
( |
| ) |
[inline] |
unlocks a read or write protection
If this object is in write-mode, this write-protection is unlocked. Else the number of readers is decremented. The reading-protection is finally unlocked, if no other reader is reading the object.
The documentation for this class was generated from the following file: