Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
|
FXReadWriteLock allows multiple readers but only a single writer. More...
#include <FXReadWriteLock.h>
Public Member Functions | |
FXReadWriteLock () | |
Initialize the read/write lock. | |
void | readLock () |
Acquire read lock for read/write lock. | |
FXbool | tryReadLock () |
Try to acquire read lock for read/write lock. | |
void | readUnlock () |
Unlock read lock. | |
FXbool | readLocked () |
Test if read locked. | |
void | writeLock () |
Acquire write lock for read/write mutex. | |
FXbool | tryWriteLock () |
Try to acquire write lock for read/write lock. | |
void | writeUnlock () |
Unlock write mutex. | |
FXbool | writeLocked () |
Test if write locked. | |
~FXReadWriteLock () | |
Delete the read/write lock. | |
FXReadWriteLock allows multiple readers but only a single writer.
FXReadWriteLock provides access to a shared region just like FXMutex, except that threads that just read from the shared variables are not excluding each other. When a thread tries to write, however, it can only proceed when no other writers or readers are present. Thus, data structures which are frequently inspected but rarely updated can be more effectively accessed with a read/write lock than with a mutex.
Copyright © 1997-2022 Jeroen van der Zijp |