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...
 

Protected Attributes

const MutexmMutex
 The reference to the mutex. More...
 

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;
}

Constructor & Destructor Documentation

◆ Locker()

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

The constructor.

Parameters
mutexThe mutex to Mutex::Lock().

◆ ~Locker()

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

The destructor.

Mutex::Unlock() the mutex.

Member Data Documentation

◆ mMutex

const Mutex& Murl::System::Locker::mMutex
protected

The reference to the mutex.


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


Copyright © 2011-2018 Spraylight GmbH.