Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
Nz::LockGuard Class Reference

Core class that represents a mutex wrapper that provides a convenient RAII-style mechanism. More...

Public Member Functions

 LockGuard (Mutex &mutex, bool lock=true)
 Constructs a LockGuard object with a mutex. More...
 
 ~LockGuard ()
 Destructs a LockGuard object and unlocks the mutex if it was previously locked.
 
void Lock ()
 Locks the underlying mutex. More...
 
bool TryLock ()
 Tries to lock the underlying mutex. More...
 
void Unlock ()
 Unlocks the underlying mutex. More...
 

Detailed Description

Core class that represents a mutex wrapper that provides a convenient RAII-style mechanism.

Constructor & Destructor Documentation

◆ LockGuard()

Nz::LockGuard::LockGuard ( Mutex mutex,
bool  lock = true 
)
inline

Constructs a LockGuard object with a mutex.

Parameters
mutexMutex to lock
lockShould the mutex be locked by the constructor

Member Function Documentation

◆ Lock()

void Nz::LockGuard::Lock ( )
inline

Locks the underlying mutex.

See also
Mutex::Lock

◆ TryLock()

bool Nz::LockGuard::TryLock ( )
inline

Tries to lock the underlying mutex.

See also
Mutex::TryLock
Returns
true if the lock was acquired successfully

◆ Unlock()

void Nz::LockGuard::Unlock ( )
inline

Unlocks the underlying mutex.

See also
Mutex::Unlock

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