nCine::ReadWriteLock class

Read/write lock for thread synchronization.

Wraps a slim reader/writer lock on Windows and a pthread_rwlock_t otherwise. Allows any number of concurrent readers but only one exclusive writer at a time. Non-copyable.

Constructors, destructors, conversion operators

ReadWriteLock()
~ReadWriteLock()
ReadWriteLock(const ReadWriteLock&) deleted

Public functions

auto operator=(const ReadWriteLock&) -> ReadWriteLock& deleted
void EnterReadLock()
Acquires the lock for shared (read) access, blocking until available.
void EnterWriteLock()
Acquires the lock for exclusive (write) access, blocking until available.
auto TryEnterReadLock() -> int
Tries to acquire shared (read) access without blocking.
auto TryEnterWriteLock() -> int
Tries to acquire exclusive (write) access without blocking.
void ExitReadLock()
Releases shared (read) access.
void ExitWriteLock()
Releases exclusive (write) access.