Reader-writer lock wrapping std::shared_mutex. More...
#include <readwritelock.h>
Classes | |
| class | ReadLocker |
| RAII scoped locker for shared (read) access. More... | |
| class | WriteLocker |
| RAII scoped locker for exclusive (write) access. More... | |
Public Member Functions | |
| ReadWriteLock ()=default | |
| Constructs an unlocked ReadWriteLock. | |
| ~ReadWriteLock ()=default | |
| Destructor. | |
| ReadWriteLock (const ReadWriteLock &)=delete | |
| ReadWriteLock & | operator= (const ReadWriteLock &)=delete |
| ReadWriteLock (ReadWriteLock &&)=delete | |
| ReadWriteLock & | operator= (ReadWriteLock &&)=delete |
| void | lockForRead () |
| Acquires a shared (read) lock. Multiple readers may hold this concurrently. | |
| void | lockForWrite () |
| Acquires an exclusive (write) lock. Blocks until all readers and writers release. | |
| void | unlock () |
| Releases the currently held lock (shared or exclusive). | |
| bool | tryLockForRead () |
| Attempts to acquire a shared (read) lock without blocking. | |
| bool | tryLockForWrite () |
| Attempts to acquire an exclusive (write) lock without blocking. | |
Reader-writer lock wrapping std::shared_mutex.
Allows multiple concurrent readers or a single exclusive writer. Provides nested RAII ReadLocker and WriteLocker types. Non-copyable and non-movable.
|
inline |
Attempts to acquire a shared (read) lock without blocking.
|
inline |
Attempts to acquire an exclusive (write) lock without blocking.