C++ UA Server SDK  1.5.0.318
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
UaMutexLocker Class Reference

UaMutexLocker. More...

#include <uamutex.h>

Public Member Functions

 UaMutexLocker (UaMutex *pMutex)
 construction Constructs a UaMutexLocker object and locks passed pMutex to block access to a resource. More...
 
 ~UaMutexLocker ()
 destruction Destroys the UaMutexLocker object and unlocks the mutex object that was locked in the constructor.
 
void unlock ()
 Unlocks the mutex. More...
 
void lock (UaMutex *pMutex)
 Locks the mutex. More...
 

Detailed Description

UaMutexLocker.

Auto lock and unlock class for Mutex class. The UaMutexLocker class is a convenience class that simplifies locking and unlocking of a mutex. Locking and unlocking an UaMutex in complex functions and statements or in exception handling code is error-prone and difficult to debug. UaMutexLocker can be used in such situations to ensure that the state of the mutex is always well-defined. UaMutexLocker should be created within a function where an UaMutex needs to be locked. The mutex is locked when UaMutexLocker is created. You can unlock the mutex with unlock(). If locked, the mutex will be unlocked when the UaMutexLocker is destroyed. It is not possible to create shallow copies of this Class.

Constructor & Destructor Documentation

UaMutexLocker::UaMutexLocker ( UaMutex pMutex)

construction Constructs a UaMutexLocker object and locks passed pMutex to block access to a resource.

The mutex will be unlocked when the UaMutexLocker is destroyed.

Parameters
pMutexthe mutex to lock.

Member Function Documentation

void UaMutexLocker::lock ( UaMutex pMutex)

Locks the mutex.

Parameters
pMutexthe mutex to lock.
void UaMutexLocker::unlock ( )

Unlocks the mutex.


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