#include <Pt/System/Mutex.h>
Synchronisation device similar to a POSIX rwlock. More...
Inherits NonCopyable.
Public Member Functions | |
| ReadWriteMutex () | |
| Constructor. | |
| ~ReadWriteMutex () | |
| Destructor. | |
| void | readLock () |
| Acquires a read lock. More... | |
| bool | tryReadLock () |
| Tries to acquire a read lock. More... | |
| bool | tryWriteLock () |
| Tries to acquire a write lock. More... | |
| void | unlock () |
| Releases the read or write lock. | |
| void | writeLock () |
| Acquires a write lock. More... | |
A ReadWriteMutex allows multiple concurrent readers or one exclusive writer to access a resource.
| void readLock | ( | ) |
If another thread currently holds a write lock, this method waits until the write lock is released.
| bool tryReadLock | ( | ) |
Immediately returns true if successful, or false if one or more other threads currently hold locks. The result is undefined if the same thread already holds a read or write lock.
| void writeLock | ( | ) |
If one or more other threads currently hold locks, this method waits until all locks are released. The results are undefined if the same thread already holds a read or write lock.
| bool tryWriteLock | ( | ) |
Immediately returns true if successful, or false if one or more other threads currently hold locks. The result is undefined if the same thread already holds a read or write lock.