55 enum Type { BigWork, SmallWork, MultiRead };
57 Lock(
bool for_just_a_few_operations=
false);
60 Lock& operator =(
const Lock&);
65 inline bool isMutex()
const {
return (
bool)mutex_; }
67 inline bool isRWLock()
const {
return (
bool)rwlock_;}
87 enum WaitType { WaitIfLocked, DontWaitForLock };
100 inline bool isLocked()
const {
return needunlock_; }
105 void reLock(
WaitType wt=WaitIfLocked);
106 bool convertToWriteLock();
117 Locker(
const Locker&);
119 Locker& operator =(
const Locker&);
#define mExpClass(module)
Definition: commondefs.h:157
Mutex * mutex_
Definition: threadlock.h:74
Locks the lock, shutting out access from other threads if needed.
Definition: threadlock.h:83
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:87
Mutex & mutex()
Definition: threadlock.h:68
A lock of a type that (hopefully) suits your needs. To use it, you need the Locker class...
Definition: threadlock.h:51
Lock & lock_
Definition: threadlock.h:111
bool needunlock_
Definition: threadlock.h:112
ReadWriteLock * rwlock_
Definition: threadlock.h:76
#define mGlobal(module)
Definition: commondefs.h:160
bool lockSimpleSpinLock(volatile int &lock, Locker::WaitType)
bool isread_
Definition: threadlock.h:113
SpinLock * splock_
Definition: threadlock.h:75
RWType
Definition: threadlock.h:89
bool isLocked() const
Definition: threadlock.h:100
interface to threads that should be portable.
Definition: atomic.h:24
Is an alternative to Mutex. It is a lock which causes a thread trying to acquire it to simply wait in...
Definition: atomic.h:130
SpinLock & spinLock()
Definition: threadlock.h:69
Type
Definition: threadlock.h:55
bool isMutex() const
Definition: threadlock.h:65
Is a lock that allows a thread to have exlusive rights to something.
Definition: thread.h:43
bool isSpinLock() const
Definition: threadlock.h:66
bool isRWLock() const
Definition: threadlock.h:67
virtual ~Locker()
Definition: threadlock.h:98
void unlockSimpleSpinLock(volatile int &lock)
bool lockSimpleSpinWaitLock(volatile int &lock)
ReadWriteLock & readWriteLock()
Definition: threadlock.h:70