class Poco::RWLock
Overview
A reader writer lock allows multiple concurrent readers or one exclusive writer. Moreā¦
#include <RWLock.h> class RWLock: private Poco::RWLockImpl { public: // typedefs typedef ScopedRWLock ScopedLock; typedef ScopedReadRWLock ScopedReadLock; typedef ScopedWriteRWLock ScopedWriteLock; // methods void readLock(); bool tryReadLock(); void writeLock(); bool tryWriteLock(); void unlock(); };
Inherited Members
protected: // methods bool tryReadLockImpl(); bool tryWriteLockImpl(); void readLockImpl(); bool tryReadLockImpl(DWORD timeout = 1); void writeLockImpl(); bool tryWriteLockImpl(DWORD timeout = 1); void unlockImpl();
Detailed Documentation
A reader writer lock allows multiple concurrent readers or one exclusive writer.
Construction
~RWLock()
Destroys the Reader/Writer lock.
Methods
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.
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
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.