57 enum Type { BigWork, SmallWork, MultiRead };
59 Lock(
bool for_just_a_few_operations=
false);
62 Lock& operator =(
const Lock&);
67 inline bool isMutex()
const {
return (
bool)mutex_; }
69 inline bool isRWLock()
const {
return (
bool)rwlock_;}
89 enum WaitType { WaitIfLocked, DontWaitForLock };
102 inline bool isLocked()
const {
return needunlock_; }
107 void reLock(
WaitType wt=WaitIfLocked);
108 bool convertToWriteLock();
119 Locker(
const Locker&);
121 Locker& operator =(
const Locker&);
#define mExpClass(module)
Definition: commondefs.h:160
Mutex * mutex_
Definition: threadlock.h:76
Locks the lock, shutting out access from other threads if needed.
Definition: threadlock.h:85
Lock that permits multiple readers to lock the object at the same time, but it will not allow any rea...
Definition: thread.h:141
WaitType
Definition: threadlock.h:89
Mutex & mutex()
Definition: threadlock.h:70
A lock of a type that (hopefully) suits your needs. To use it, you need the Locker class...
Definition: threadlock.h:53
Lock & lock_
Definition: threadlock.h:113
bool needunlock_
Definition: threadlock.h:114
ReadWriteLock * rwlock_
Definition: threadlock.h:78
#define mGlobal(module)
Definition: commondefs.h:163
bool lockSimpleSpinLock(volatile int &lock, Locker::WaitType)
bool isread_
Definition: threadlock.h:115
SpinLock * splock_
Definition: threadlock.h:77
RWType
Definition: threadlock.h:91
bool isLocked() const
Definition: threadlock.h:102
interface to threads that should be portable.
Definition: atomic.h:28
Is an alternative to Mutex. It is a lock which causes a thread trying to acquire it to simply wait in...
Definition: atomic.h:200
SpinLock & spinLock()
Definition: threadlock.h:71
Type
Definition: threadlock.h:57
bool isMutex() const
Definition: threadlock.h:67
Is a lock that allows a thread to have exlusive rights to something.
Definition: thread.h:43
bool isSpinLock() const
Definition: threadlock.h:68
bool isRWLock() const
Definition: threadlock.h:69
virtual ~Locker()
Definition: threadlock.h:100
void unlockSimpleSpinLock(volatile int &lock)
bool lockSimpleSpinWaitLock(volatile int &lock)
ReadWriteLock & readWriteLock()
Definition: threadlock.h:72