Library: Foundation
Package: Threading
Header: Poco/RWLock.h
A reader writer lock allows multiple concurrent readers or one exclusive writer.
Direct Base Classes: RWLockImpl
All Base Classes: RWLockImpl
Member Functions: readLock, tryReadLock, tryWriteLock, unlock, writeLock
typedef ScopedRWLock ScopedLock;
typedef ScopedReadRWLock ScopedReadLock;
typedef ScopedWriteRWLock ScopedWriteLock;
RWLock();
Creates the Reader/Writer lock.
~RWLock();
Destroys the Reader/Writer lock.
void readLock();
Acquires a read lock. If another thread currently holds a write lock, waits until the write lock is released.
bool tryReadLock();
Tries to acquire a read lock. Immediately returns true if successful, or false if another thread currently holds a write lock.
bool tryWriteLock();
Tries to acquire a write lock. 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 unlock();
Releases the read or write lock.
void writeLock();
Acquires a write lock. If one or more other threads currently hold locks, waits until all locks are released. The results are undefined if the same thread already holds a read or write lock