Itasca C++ Interface
|
An automatic QMutex lock/unlock helper class. More...
#include <basemutex.h>
Public Member Functions | |
IMutexLocker (QMutex *mutex) | |
Lock the mutex on construction, default simple version. | |
IMutexLocker (QMutex *mutex, int time, int line, const char *file) | |
~IMutexLocker () | |
Destructor, if locked unlocks the mutex. | |
QMutex * | mutex () |
Returns a pointer to the mutex claimed by this locker. | |
void | unlock () |
Explicitly unlocks the mutex before destruction. | |
void | relock (int time=30000, int line=0, const char *file=0) |
Explicitly relocks the mutex after destruction, if unlock() was called. | |
An automatic QMutex lock/unlock helper class.
Similar to QMutexLocker, but adds some debugging aids.
Specifically, file,line tracking of who is asking for the mutex.
Also, allows a "timeout" error to be thrown to help detect race conditions. This class is not intended to be created directly, instead use the macros LOCK_MUTEX1, LOCK_MUTEX2, and LOCK_MUTEX3. The QMutexLocker class itself is disabled via use of the preprocessor, to force coders to use this version.
|
inline |
Lock the mutex on constructor, but allows specification of timeout time, file name and line number.
mutex | A pointer to the mutex being claimed. |
time | The timeout time in milliseconds. |
line | The line number of the source where IMutexLocker was created. |
file | The file name of the source where IMutexLocker was created. |