Public Member Functions

CxUtils::Mutex::ScopedLock Class Reference

Class for enabling a Mutex within a specific program scope which will unlock the mutex when out of scope (when object is destroyed). More...

#include <mutex.h>

List of all members.

Public Member Functions

 ScopedLock (const Mutex *mutex)
 Constructor. This initializes a ScopedLock by locking the mutex. Once the ScopedLock object goes out of scope (or is deleted), the Mutex is automatically unlocked by the destructor.
 ~ScopedLock ()
 Destructor. On destruction, the Mutex is unlocked automatically.

Detailed Description

Class for enabling a Mutex within a specific program scope which will unlock the mutex when out of scope (when object is destroyed).

The ScopedLock mutex is designed to prevent deadlocks. It will only lock the provided mutex in the current thread if it hasn't been locked yet, and will only unlock if the ScopedLock instanced called lock. Unlock is done when the object goes out of scope or is deleted.

Definition at line 330 of file mutex.h.


Constructor & Destructor Documentation

Mutex::ScopedLock::ScopedLock ( const Mutex mutex )

Constructor. This initializes a ScopedLock by locking the mutex. Once the ScopedLock object goes out of scope (or is deleted), the Mutex is automatically unlocked by the destructor.

Parameters:
[in]mutexPointer to Mutex to lock within a specific scope.

Definition at line 73 of file mutex.cpp.

Mutex::ScopedLock::~ScopedLock (  )

Destructor. On destruction, the Mutex is unlocked automatically.

Definition at line 94 of file mutex.cpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines