class CryReadModifyLock;
CryThread.h
Sync primitive for multiple reads and exclusive locking change access
Desc: Useful in case if you have rarely modified object that needs to be read quite often from different threads but still need to be exclusively modified sometimes Debug functionality: Can be used for debug-only lock calls, which verify that no simultaneous access is attempted. Use the bDebug argument of LockRead or LockModify, or use the DEBUG_READLOCK or DEBUG_MODIFYLOCK macros. There is no overhead in release builds, if you use the macros, and the lock definition is inside #ifdef _DEBUG.
mutable bool m_debugLocked;
mutable const char* m_debugLockStr;
mutable volatile int m_modifyCount;
mutable volatile int m_readCount;
mutable CryEvent m_ReadReleased;
mutable CryCriticalSection m_writeLock;
CryReadModifyLock();
bool LockModify(bool bTry = false, cstr strDebug = 0, bool bDebug = false) const;
bool LockRead(bool bTry = false, cstr strDebug = 0, bool bDebug = false) const;
void SetDebugLocked(bool b, const char* str = 0) const;
void UnlockModify() const;
void UnlockRead() const;
bool WriteLock(bool bTry, bool bDebug, const char* strDebug) const;