3#include "baseexception.h" 
   35        if (not mutex_->tryLock(time))
 
   36            throw Exception(
"Mutex timeout in {} / {}.",line,file);
 
 
   42    QMutex *
mutex() { 
return mutex_; }
 
   44    void unlock() { 
if (mutex_ and locked_) { mutex_->unlock();  locked_ = 
false; } }
 
   46    void relock(
int time=30000,
int line=0,
const char *file=0) { 
 
   47        if (mutex_ && not locked_)  { 
 
   48            if (!mutex_->tryLock(time))
 
   49                throw Exception(
"Mutex timeout in {} / {}.",line,file);
 
 
 
   62#define LOCK_MUTEX1(mutexpnt)           IMutexLocker default_mutex_name(mutexpnt,30000,__LINE__,__FILE__) 
   68#define LOCK_MUTEX2(name,mutexpnt)      IMutexLocker name(mutexpnt,30000,__LINE__,__FILE__) 
   74#define LOCK_MUTEX3(name,mutexpnt,time) IMutexLocker name(mutexpnt,time,__LINE__,__FILE__) 
   76#define QMutexLocker ERROR_SHOULD_NOT_CREATE_DIRECTLY 
Base exception class for all Itasca code.
Definition baseexception.h:10
An automatic QMutex lock/unlock helper class.
Definition basemutex.h:21
IMutexLocker(QMutex *mutex)
Lock the mutex on construction, default simple version.
Definition basemutex.h:24
void relock(int time=30000, int line=0, const char *file=0)
Explicitly relocks the mutex after destruction, if unlock() was called.
Definition basemutex.h:46
IMutexLocker(QMutex *mutex, int time, int line, const char *file)
Definition basemutex.h:33
~IMutexLocker()
Destructor, if locked unlocks the mutex.
Definition basemutex.h:40
void unlock()
Explicitly unlocks the mutex before destruction.
Definition basemutex.h:44
QMutex * mutex()
Returns a pointer to the mutex claimed by this locker.
Definition basemutex.h:42