C++ Based OPC UA Client/Server SDK
1.5.5.355
|
#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... | |
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.
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.
pMutex | the mutex to lock. |
void UaMutexLocker::lock | ( | UaMutex * | pMutex | ) |
Locks the mutex.
pMutex | the mutex to lock. |
void UaMutexLocker::unlock | ( | ) |
Unlocks the mutex.