You.i Engine
CYIAutoReadMutex Class Reference

Detailed Description

The CYIAutoReadMutex is a helper class that simplifies the locking and unlocking of read/write mutexes based on the RAII principle. The constructor will perform a read-lock while the destructor automatically perform an unlock.

See also
CYIAutoWriteMutex
CYIReadWriteMutex
CYISpinLock
yi::deprecated::CYIAutoSpinLock

#include <thread/YiAutoReadMutex.h>

Public Member Functions

 CYIAutoReadMutex (CYIReadWriteMutex &rMutex)
 
 ~CYIAutoReadMutex ()
 
bool Relock ()
 
bool Unlock ()
 

Constructor & Destructor Documentation

◆ CYIAutoReadMutex()

CYIAutoReadMutex::CYIAutoReadMutex ( CYIReadWriteMutex rMutex)
inline

Constructs a CYIAutoReadMutex and performs a read-lock on the m_rMutex. The CYIAutoReadMutex will automatically unlock when the instance is destroyed.

◆ ~CYIAutoReadMutex()

CYIAutoReadMutex::~CYIAutoReadMutex ( )
inline

Destroys the CYIAutoReadMutex and unlocks m_rMutex that was locked by the constructor.

Member Function Documentation

◆ Relock()

bool CYIAutoReadMutex::Relock ( )
inline

Relocks a manually unlocked CYIAutoReadMutex.

◆ Unlock()

bool CYIAutoReadMutex::Unlock ( )
inline

Unlocks m_rMutex. You may relock the CYIAutoReadMutex using CYIAutoReadMutex::Relock().


The documentation for this class was generated from the following file: