Class PosixRWMutex

Class Documentation

class PosixRWMutex

Implementation of the Mutex and SharedMutex C++14 concepts via POSIX pthread rwlock.

The advantages of using this over std::shared_timed_mutex are: a) The type of rwlock can be selected (as per pthread_rwlock_attr_setkind_np) b) As per POSIX, read locks are recursive rather than undefined behaviour

Public Types

enum class Type

Values:

enumerator Default
enumerator PreferReader
enumerator PreferWriterNonRecursive

Public Functions

PosixRWMutex()
PosixRWMutex(Type type)
~PosixRWMutex()
PosixRWMutex(PosixRWMutex const&) = delete
PosixRWMutex &operator=(PosixRWMutex const&) = delete
void lock_shared()
bool try_lock_shared()
void unlock_shared()
void lock()
bool try_lock()
void unlock()