vrecko
virtual reality framework
|
#include <MTLock.h>
Public Member Functions | |
MTReadWriteLockEx () | |
~MTReadWriteLockEx () | |
bool | lockRead (DWORD Timeout=INFINITE) |
bool | lockWrite (DWORD Timeout=INFINITE) |
void | unlockRead (DWORD Timeout=INFINITE) |
void | unlockWrite (DWORD Timeout=INFINITE) |
MTReadWriteLockEx is more sofisticated read/write mutex. It is recursive and upgradable.
That is, a thread can acquire and release read and write locks in arbitrary order The only rule is that every successfully acquired lock must be eventually released
E.g. LockRead(), LockWrite(), UnlockRead(), UnlockWrite() is allowed sequence.
MTReadWriteLockEx prefers writers over readers. E.g., when a writer is waiting for the lock, no new readers can acquire the lock. Existing readers may continue to use the lock. This policy prevents so-called "writer starvation" when writers never get access to the lock because of too much readers.
vrecko::MTReadWriteLockEx::MTReadWriteLockEx | ( | ) |
vrecko::MTReadWriteLockEx::~MTReadWriteLockEx | ( | ) |
MTLOCK_IMP_EXP bool vrecko::MTReadWriteLockEx::lockRead | ( | DWORD | Timeout = INFINITE | ) |
MTLOCK_IMP_EXP bool vrecko::MTReadWriteLockEx::lockWrite | ( | DWORD | Timeout = INFINITE | ) |
MTLOCK_IMP_EXP void vrecko::MTReadWriteLockEx::unlockRead | ( | DWORD | Timeout = INFINITE | ) |
MTLOCK_IMP_EXP void vrecko::MTReadWriteLockEx::unlockWrite | ( | DWORD | Timeout = INFINITE | ) |