Murl::System::Locker Class Reference
The locker class for scoped Mutex locking. More...
#include "murl_system_mutex.h"
Inheritance diagram for Murl::System::Locker:
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 Mutex & | mMutex |
The reference to the mutex. | |
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:158
Constructor & Destructor Documentation
◆ Locker()
|
inlineexplicit |
The constructor.
- Parameters
-
mutex The mutex to Mutex::Lock().
References Murl::System::Mutex::Lock(), and mMutex.
◆ ~Locker()
|
inline |
The documentation for this class was generated from the following file:
- murl_system_mutex.h