10#include <shared_mutex>
110 return _mutex.try_lock_shared();
118 return _mutex.try_lock();
122 std::shared_mutex _mutex;
RAII scoped locker for shared (read) access.
Definition readwritelock.h:28
~ReadLocker()
Destructor. Releases the shared lock.
Definition readwritelock.h:39
ReadLocker(ReadWriteLock &lock)
Constructs a ReadLocker and acquires a shared lock.
Definition readwritelock.h:34
RAII scoped locker for exclusive (write) access.
Definition readwritelock.h:55
WriteLocker(ReadWriteLock &lock)
Constructs a WriteLocker and acquires an exclusive lock.
Definition readwritelock.h:61
~WriteLocker()
Destructor. Releases the exclusive lock.
Definition readwritelock.h:66
Reader-writer lock wrapping std::shared_mutex.
Definition readwritelock.h:23
void lockForRead()
Acquires a shared (read) lock. Multiple readers may hold this concurrently.
Definition readwritelock.h:91
void unlock()
Releases the currently held lock (shared or exclusive).
Definition readwritelock.h:101
bool tryLockForWrite()
Attempts to acquire an exclusive (write) lock without blocking.
Definition readwritelock.h:117
~ReadWriteLock()=default
Destructor.
ReadWriteLock()=default
Constructs an unlocked ReadWriteLock.
void lockForWrite()
Acquires an exclusive (write) lock. Blocks until all readers and writers release.
Definition readwritelock.h:96
bool tryLockForRead()
Attempts to acquire a shared (read) lock without blocking.
Definition readwritelock.h:109
#define PROMEKI_NAMESPACE_BEGIN
Starts a promeki namespace block.
Definition namespace.h:14
#define PROMEKI_NAMESPACE_END
Ends a promeki namespace block.
Definition namespace.h:19