#include <prwlock.h>
Public Member Functions | |
| RWLock (const char *name=0) throw (SyncError) | |
| Default constructor. | |
| ~RWLock () throw () | |
| Destructor. | |
| void | readLock () throw (SyncError) |
| Lock the read-write lock for reading. | |
| bool | tryReadLock (unsigned int timeout) throw (SyncError) |
| Try to lock the read-write lock for reading with timeout. | |
| void | writeLock () throw (SyncError) |
| Lock the read-write lock for writing. | |
| bool | tryWriteLock (unsigned int timeout) throw (SyncError) |
| Try to lock the mutex for writing with timeout. | |
| void | unlock () throw (SyncError) |
| Release the previously acquired lock. | |
A read-write lock is like a mutex but allows multiple readers or one writer to hold the lock at the same time. Also, read-write locks are not recursive. On Win32 systems the read-write lock is implemented using a mutex which does not allow multiple readers.
Definition at line 38 of file prwlock.h.
|
|
Default constructor. Construct the RWLock object. If a name is given, the read-write lock can be shared by multiple processes, otherwise a process- local rwlock is created. On POSIX systems that support SYSV shared memory process-shared rwlock's are implemented using a shared memory segment which contains the pthread_rwlock_t structure.
|
|
|
Destructor. The destructor destroys the read-write lock. The rwlock must be in unlocked state when the destructor is called. On POSIX systems this also removes the shared memory segment which contains the pthread_rwlock_t structure if no more processes reference to it. |
|
|
Lock the read-write lock for reading. If the read-write lock is currently locked for writing by another thread the calling thread suspends until the write-lock has been released. If another thread already holds a read-lock, or the read- write lock is currently unlocked the function returns immediatly.
Referenced by P::RWLock::ReadLock::operator=(). |
|
|
Try to lock the read-write lock for reading with timeout. This method does the same than readLock() but also supports a timeout- value. If the read-lock cannot be acquired in the given interval the method returns without locking the rwlock and a FALSE return value.
|
|
|
Try to lock the mutex for writing with timeout. This method does the same than writeLock() but also supports a timeout- value. If the lock cannot be acquired in the given interval the method returns without locking the rwlock and a FALSE return value.
|
|
|
Release the previously acquired lock.
|
|
|
Lock the read-write lock for writing. If the read-write lock is currently locked for reading or writing by another thread, the calling thread suspends until the lock has been released. If the read-write lock is currently unlocked, the function returns immediatly.
Referenced by P::RWLock::WriteLock::operator=(). |
1.3.3