46 Mutex(
bool recursive=
false );
68 ThreadID lockingthread_;
73 int getCount()
const {
return count_; }
116 bool wait(
unsigned long timeout);
120 void signal(
bool all);
145 ReadWriteLock(
const ReadWriteLock&);
146 virtual ~ReadWriteLock();
160 void permissiveWriteLock();
167 void permissiveWriteUnLock();
169 bool convReadToWriteLock();
174 void convWriteToReadLock();
177 void convPermissiveToWriteLock();
178 void convWriteToPermissive();
203 #define mLockerClassImpl( mod, clssnm, clss, lockfn, unlockfn, trylockfn ) \ 204 mExpClass(mod) clssnm \ 207 clssnm( clss& thelock, bool wait=true ) \ 209 , islocked_( true ) \ 211 if ( wait ) thelock.lockfn; \ 212 else islocked_ = thelock.trylockfn; \ 215 ~clssnm() { if ( islocked_ ) lock_.unlockfn; } \ 216 bool isLocked() const { return islocked_; } \ 218 void unLock() { islocked_ = false; lock_.unlockfn; } \ 221 void lock() { islocked_ = true; lock_.lockfn; } \ 234 readLock(), readUnLock(), tryReadLock() )
247 Barrier(
int nrthreads=-1,
bool immediatrelease=
true);
248 void setNrThreads(
int);
251 bool waitForAll(
bool unlock=
true);
263 void releaseAllNoLock();
269 void releaseAllInternal();
294 Thread(
void (*)(
void*),
const char* nm);
295 Thread(
const CallBack&,
const char* nm);
298 ThreadID threadID()
const;
300 void waitForFinish();
304 const char* getName()
const;
#define mExpClass(module)
Definition: commondefs.h:157
Is an object that faciliates many threads to wait for something to happen.
Definition: thread.h:108
Mutex & mutex()
Definition: thread.h:266
Lock that permits multiple readers to lock the object at the same time, but it will not allow any rea...
Definition: thread.h:141
int nrThreads() const
Definition: thread.h:249
#define mQtclass(cls)
Definition: commondefs.h:232
#define mGlobal(module)
Definition: commondefs.h:160
ConditionVar condvar_
Definition: thread.h:271
bool immediaterelease_
Definition: thread.h:276
Definition: i_layout.h:33
#define mLockerClassImpl(mod, clssnm, clss, lockfn, unlockfn, trylockfn)
Is an object that is convenient to use when a mutex should be locked and unlocked automatically when ...
Definition: thread.h:203
bool dorelease_
Definition: thread.h:274
int nrthreads_
Definition: thread.h:272
bool isLockedForWrite() const
Definition: thread.h:149
interface to threads that should be portable.
Definition: atomic.h:24
bool isLockedForRead() const
Definition: thread.h:150
int getSystemNrProcessors()
Is the base class for all threads. Start it by creating it and give it the function or CallBack to ex...
Definition: thread.h:290
void * ThreadID
Definition: thread.h:33
int threadcount_
Definition: thread.h:273
int nrreaders_
Definition: thread.h:181
char status_
Definition: thread.h:182
bool isLocked() const
Definition: thread.h:148
void sleep(double seconds)
#define mFDQtclass(cls)
Definition: commondefs.h:231
Waits for a number of threads to reach a certain point (i.e. the call to Barrier::waitForAll). Once everyone has arrived, everyone is released.
Definition: thread.h:244
ConditionVar statuscond_
Definition: thread.h:185
Is a lock that allows a thread to have exlusive rights to something.
Definition: thread.h:43
void setCurrentThreadProcessorAffinity(int cpu)
CallBacks object-oriented (object + method).
Definition: callback.h:62