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 MutexmMutex
 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()

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

The constructor.

mutexThe mutex to Mutex::Lock().

References Murl::System::Mutex::Lock(), and mMutex.

◆ ~Locker()

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

The destructor.

Mutex::Unlock() the mutex.

References mMutex, and Murl::System::Mutex::Unlock().

The documentation for this class was generated from the following file:
  • murl_system_mutex.h

Copyright © 2011-2024 Spraylight GmbH.