A Read/Write lock -- a synchronization primitive that allows multiple threads to coordinate access to a mutable resource. More...
#include <ReadWriteLock.h++>
Public Member Functions | |
| ReadWriteLock () throw () | |
| Construct a new ReadWriteLock. | |
| ~ReadWriteLock () throw () | |
| Destructor. | |
| void | lockRead () throw () |
| Acquire a read lock, blocking until the lock is acquired. | |
| bool | tryLockRead (timespan_ms_t timeout=0) throw () |
| Try to acquire a read lock, returning if the lock could not be acquired within the given amount of time. | |
| void | lockWrite () throw () |
| Acquire a write lock, blocking until the lock is acquired. | |
| bool | tryLockWrite (timespan_ms_t timeout=0) throw () |
| Try to acquire a write lock, returning if the lock could not be acquired within the given amount of time. | |
| void | unlock () throw () |
| Release the lock. | |
Static Public Member Functions | |
| static bool | supportsTimedLocks () throw () |
| Determine if the host system supports timed read/write locks. | |
A Read/Write lock -- a synchronization primitive that allows multiple threads to coordinate access to a mutable resource.
Any number of threads can simultaneously hold the read lock as long as no thread holds the write lock. Conversely, a thread can acquire the write lock as long as no threads are holding the read lock.
See also ScopedReadLock and ScopedWriteLock.
| ReadWriteLock | ( | ) | throw () |
Construct a new ReadWriteLock.
| ~ReadWriteLock | ( | ) | throw () |
Destructor.
| void lockRead | ( | ) | throw () |
Acquire a read lock, blocking until the lock is acquired.
| void lockWrite | ( | ) | throw () |
Acquire a write lock, blocking until the lock is acquired.
| bool supportsTimedLocks | ( | ) | throw () [static] |
Determine if the host system supports timed read/write locks.
| bool tryLockRead | ( | timespan_ms_t | timeout = 0 |
) | throw () |
Try to acquire a read lock, returning if the lock could not be acquired within the given amount of time.
On platforms that do not support timed read/write locks, the method returns immediately if the lock could not be acquired.
| timeout | The timeout, in milliseconds. |
| bool tryLockWrite | ( | timespan_ms_t | timeout = 0 |
) | throw () |
Try to acquire a write lock, returning if the lock could not be acquired within the given amount of time.
On platforms that do not support timed read/write locks, the method returns immediately if the lock could not be acquired.
| timeout | The timeout, in milliseconds. |
| void unlock | ( | ) | throw () |
Release the lock.
1.6.3