CyberEngineMkIII
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Private Attributes | List of all members
CYB::API::LockGuard Class Reference

A RAII locking mechanism. More...

#include <LockGuard.hpp>

Collaboration diagram for CYB::API::LockGuard:
Collaboration graph
[legend]

Public Member Functions

 LockGuard (Mutex &AMutex, const bool APreLocked=false) noexcept
 Construct a LockGuard that will hold a lock on AMutex. More...
 
 LockGuard (const LockGuard &)=delete
 See Default Constructors and Destructor.
 
 LockGuard (LockGuard &&AMove) noexcept
 See Default Constructors and Destructor.
 
LockGuardoperator= (LockGuard &&AMove) noexcept
 See Default Constructors and Destructor.
 
 ~LockGuard ()
 Destroys the LockGuard and unlocks the Mutex.
 
void Release (void) noexcept
 Releases the lock on Mutex, this same LockGuard can never reaquire it. More...
 

Private Attributes

MutexFMutex
 A reference to the owned Mutex.
 

Detailed Description

A RAII locking mechanism.

Definition at line 7 of file LockGuard.hpp.

Constructor & Destructor Documentation

CYB::API::LockGuard::LockGuard ( Mutex AMutex,
const bool  APreLocked = false 
)
noexcept

Construct a LockGuard that will hold a lock on AMutex.

Parameters
AMutexThe Mutex to lock
APreLockedIf the Mutex is already locked by the calling thread this should be true, false otherwise
Thread Safety
This function will attempt to lock AMutex

Member Function Documentation

void CYB::API::LockGuard::Release ( void  )
noexcept

Releases the lock on Mutex, this same LockGuard can never reaquire it.

Thread Safety
This function will attempt unlock the owned Mutex

Here is the caller graph for this function:


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