API FOR ADVANCED USERS – This class is a wrapper class that locks the mutex in the constructor or when the mutex is assigned, and unlocks the mutex in the destructor, if assigned. More...
#include <ilserver/ilthread.h>
Public Member Functions | |
IlsSafeMutexLocker (IlsSafeMutex *m=0) | |
Constructor. More... | |
void | assign (IlsSafeMutex *m=0) |
This member function assigns the mutex. More... | |
API FOR ADVANCED USERS – This class is a wrapper class that locks the mutex in the constructor or when the mutex is assigned, and unlocks the mutex in the destructor, if assigned.
Library: server
and mvcomp
The wrapper must not be used among multiple threads; only the pointer to the mutex that is being locked can be shared among different threads. This class is normally used as a local variable within a procedure.
IlsSafeMutex
, IlsThread
, IlsUnsafeMutex
, IlsUnsafeMutexLocker
. IlsSafeMutexLocker::IlsSafeMutexLocker | ( | IlsSafeMutex * | m = 0 | ) |
Constructor.
The pointer to the mutex must be passed to the constructor, if the constructor is to lock the mutex.
void IlsSafeMutexLocker::assign | ( | IlsSafeMutex * | m = 0 | ) |
This member function assigns the mutex.
The mutex can be assigned at any time. Setting the assigned mutex to zero will prevent the mutex from being unlocked when the mutex wrapper is destroyed. Assigning a mutex will cause the old mutex, if any, to be unlocked, and the new mutex, if any, to be locked.