A single writer, multiple reader mutex class.
#include <UTMutex.h>
Public Member Functions | |
MultiReaderMutex_t () | |
~MultiReaderMutex_t () | |
void | LockRead () |
void | UnlockRead () |
void | LockWrite () |
void | UnlockWrite () |
Definition at line 84 of file UTMutex.h.
MultiReaderMutex_t::MultiReaderMutex_t | ( | ) |
Constructor.
MultiReaderMutex_t::~MultiReaderMutex_t | ( | ) |
Destructor.
void MultiReaderMutex_t::LockRead | ( | ) |
Locks the mutex for shared read. Once acquired, the caller is guaranteed safe read-only access, with all would-be writers being blocked. Note that if the protected resource contains mutable data, simultaneous read access resulting in modification of that data is almost guaranteed to cause a crash.
void MultiReaderMutex_t::UnlockRead | ( | ) |
Unlocks the mutex after shared read.
void MultiReaderMutex_t::LockWrite | ( | ) |
Locks the mutex for exclusive write. Once acquired, the caller is guaranteed exclusive access with neither readers nor writers holding the mutex. After calling LockWrite, all would-be readers or writers will be blocked until the caller has acquired and released the requested write access.
void MultiReaderMutex_t::UnlockWrite | ( | ) |
Unlocks the mutex after exclusive write.