Murl Engine API  Version 2024.1
Murl::System::Locker Class Reference

The locker class for scoped Mutex locking. More...

#include <murl_system_mutex.h>

Detailed Description

The locker class for scoped Mutex locking.

A local instance of the locker will Lock() a mutex at object creation and automatically Unlock() the mutex when the object goes out of scope.

Bool MyMethod()
{
Locker locker(mMyMutex);
// protected code starts here
if (somethingHappens)
{
return false;
}
return true;
}
Locker(const Mutex &mutex)
The constructor.
Definition: murl_system_mutex.h:77
bool Bool
Boolean data type This typedef represents a boolean value (true or false).
Definition: murl_types.h:174
Inheritance diagram for Murl::System::Locker:
Murl::NonCopyable

Public Member Functions

 Locker (const Mutex &mutex)
 The constructor. More...
 
 ~Locker ()
 The destructor. More...
 
- Public Member Functions inherited from Murl::NonCopyable
 NonCopyable ()=default
 The default constructor.
 

Protected Attributes

const MutexmMutex
 The reference to the mutex.
 

Constructor & Destructor Documentation

◆ Locker()

Murl::System::Locker::Locker ( const Mutex mutex)
inlineexplicit

The constructor.

Parameters
mutexThe mutex to Mutex::Lock().

◆ ~Locker()

Murl::System::Locker::~Locker ( )
inline

The destructor.

Mutex::Unlock() the mutex.


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