HDK
|
Reader/Writer mutex class. More...
#include <UT_RWLock.h>
Public Types | |
typedef UT_AutoRWLockType < UT_RWLock, true > | ReadScope |
typedef UT_AutoRWLockType < UT_RWLock, false > | WriteScope |
Public Member Functions | |
UT_RWLock () | |
~UT_RWLock () | |
bool | tryReadLock (int ntrials=1) |
bool | tryWriteLock (int ntrials=1) |
void | readLock () |
void | writeLock () |
void | readUnlock () |
Release a shared read lock. More... | |
void | writeUnlock () |
Release an exclusive write lock. More... | |
Reader/Writer mutex class.
Definition at line 48 of file UT_RWLock.h.
typedef UT_AutoRWLockType<UT_RWLock, true> UT_RWLock::ReadScope |
Definition at line 91 of file UT_RWLock.h.
typedef UT_AutoRWLockType<UT_RWLock, false> UT_RWLock::WriteScope |
Definition at line 92 of file UT_RWLock.h.
UT_RWLock::UT_RWLock | ( | ) |
UT_RWLock::~UT_RWLock | ( | ) |
void UT_RWLock::readLock | ( | ) |
Attempt to acquire a shared read lock, blocking until the lock is acquired.
A thread holding the exclusive write lock may acquire a shared read lock as well, thereby holding both.
void UT_RWLock::readUnlock | ( | ) |
Release a shared read lock.
bool UT_RWLock::tryReadLock | ( | int | ntrials = 1 | ) |
Attempt to acquire a shared read lock, returning false if the shared read lock cannot be acquired immediately.
A thread holding the exclusive write lock may acquire a shared read lock as well, thereby holding both.
bool UT_RWLock::tryWriteLock | ( | int | ntrials = 1 | ) |
Attempt to acquire an exclusive write lock, returning false if the exclusive write lock cannot be acquired immediately.
It is an error to attempt to acquire an exclusive write lock while holding a shared read lock.
void UT_RWLock::writeLock | ( | ) |
Attempt to acquire an exclusive write lock, blocking until the lock is acquired.
It is an error to attempt to acquire an exclusive write lock while holding a shared read lock. If you're not sure whether you're holding the read lock or not, use tryWriteLock
instead.
void UT_RWLock::writeUnlock | ( | ) |
Release an exclusive write lock.