IlsSafeMutexLocker
Category
Thread utility class - API FOR ADVANCED USERS
Inheritance Path
IlsSafeMutexLocker
Description
IlsSafeMutexLocker is a wrapper class. A wrapper class is a class that locks the mutex in the constructor or when the mutex is assigned, and unlocks the mutex in the destructor, if assigned.
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.
Libraries
Synopsis
class IlsSafeMutexLocker
{
public:
IlsSafeMutexLocker(IlsSafeMutex* = 0);
virtual ~IlsSafeMutexLocker();
void assign(IlsUnsafeMutex* = 0);
};
Constructor
IlsSafeMutexLocker(IlsSafeMutex* = 0);
The pointer to the mutex must be passed to the constructor, if the constructor is to lock the mutex.
Destructor
virtual ~IlsSafeMutexLocker();
This is the public virtual destructor for this class.
Member Functions
void assign(IlsUnsafeMutex* = 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.
See Also
Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.