|
blocxx
|
This class is the implementation of the read/write lock. More...
#include <GenericRWLockImpl.hpp>
Classes | |
| struct | LockerInfo |
Public Member Functions | |
| GenericRWLockImpl () | |
| ~GenericRWLockImpl () | |
| void | acquireReadLock (const IdT id, const Timeout &timeout) |
| void | acquireWriteLock (const IdT id, const Timeout &timeout) |
| void | releaseReadLock (const IdT id) |
| void | releaseWriteLock (const IdT id) |
Private Types | |
| typedef std::map< IdT, LockerInfo, CompareT > | IdMap |
Private Member Functions | |
| GenericRWLockImpl (const GenericRWLockImpl &) | |
| GenericRWLockImpl & | operator= (const GenericRWLockImpl &) |
Private Attributes | |
| Condition | m_waiting_writers |
| bool | m_canRead |
| Condition | m_waiting_readers |
| NonRecursiveMutex | m_guard |
| unsigned | m_numReaders |
| unsigned | m_numWriters |
| IdMap | m_lockerInfo |
This class is the implementation of the read/write lock.
It isn't thread specific and thus may be used for other types of locking, such as for transactions which may span threads, in which case the transaction would be the id. The read/write lock is recursive and also supports upgrading a read-lock to a write lock.
Definition at line 94 of file GenericRWLockImpl.hpp.
|
private |
Definition at line 150 of file GenericRWLockImpl.hpp.
| BLOCXX_NAMESPACE::GenericRWLockImpl< IdT, CompareT >::GenericRWLockImpl |
Definition at line 160 of file GenericRWLockImpl.hpp.
References BLOCXX_NAMESPACE::TimeoutTimer::asAbsoluteTimeout(), and BLOCXX_THROW.
| BLOCXX_NAMESPACE::GenericRWLockImpl< IdT, CompareT >::~GenericRWLockImpl |
Definition at line 168 of file GenericRWLockImpl.hpp.
|
private |
| void BLOCXX_NAMESPACE::GenericRWLockImpl< IdT, CompareT >::acquireReadLock | ( | const IdT | id, |
| const Timeout & | timeout | ||
| ) |
| TimeoutException | if the lock isn't acquired within the timeout. |
Definition at line 174 of file GenericRWLockImpl.hpp.
| void BLOCXX_NAMESPACE::GenericRWLockImpl< IdT, CompareT >::acquireWriteLock | ( | const IdT | id, |
| const Timeout & | timeout | ||
| ) |
| TimeoutException | if the lock isn't acquired within the timeout. |
| DeadlockException | if this call would upgrade a read lock to a write lock and another id is already waiting to upgrade. If this happens, the calling thread must release it's read lock in order for forward progress to be made. |
Definition at line 241 of file GenericRWLockImpl.hpp.
References BLOCXX_NAMESPACE::TimeoutTimer::asAbsoluteTimeout(), BLOCXX_ASSERT, and BLOCXX_THROW.
|
private |
| void BLOCXX_NAMESPACE::GenericRWLockImpl< IdT, CompareT >::releaseReadLock | ( | const IdT | id | ) |
| GenericRWLockImplException | if a read lock hasn't been acquired. |
Definition at line 211 of file GenericRWLockImpl.hpp.
References BLOCXX_ASSERT, and m_guard.
| void BLOCXX_NAMESPACE::GenericRWLockImpl< IdT, CompareT >::releaseWriteLock | ( | const IdT | id | ) |
| GenericRWLockImplException | if a write lock hasn't been acquired. |
Definition at line 342 of file GenericRWLockImpl.hpp.
|
private |
Definition at line 127 of file GenericRWLockImpl.hpp.
|
private |
Definition at line 130 of file GenericRWLockImpl.hpp.
|
private |
Definition at line 151 of file GenericRWLockImpl.hpp.
|
private |
Definition at line 131 of file GenericRWLockImpl.hpp.
|
private |
Definition at line 132 of file GenericRWLockImpl.hpp.
|
private |
Definition at line 128 of file GenericRWLockImpl.hpp.
|
private |
Definition at line 125 of file GenericRWLockImpl.hpp.
1.8.18