15 #include <vlutil/vlMutex.h>
16 #include <vlutil/vlScopedLock.h>
48 typedef void (*LockFunction)(
void*);
66 LockFunction myUnlockCallback;
100 template <
typename T>
109 class ConstLockedProxy;
205 static void lock(
void*
object);
208 static void unlock(
void*
object);
230 #define threadSafe_inl_
231 #include "threadSafe.inl"
232 #undef threadSafe_inl_
~LockedProxy()
Destructor, releases lock.
Definition: threadSafe.h:145
ConstLockedProxy(const T &value, DtMutex &mutex)
Constructor.
Definition: threadSafe.h:161
A scoped sequence lock.
Definition: threadSafe.h:44
DtScopedLock * myExternalLock
The external lock which allows the sequence lock.
Definition: threadSafe.h:221
LockedProxy(T &value, DtMutex &mutex)
Constructor.
Definition: threadSafe.h:127
const T * myValue
Definition: threadSafe.h:186
LockedProxy operator->()
Proxy pointer access operator.
Definition: threadSafe.h:52
DtScopedSequenceLock sequenceLock()
Request a sequence lock, this object will maintain a lock on the object during it's life-time...
Definition: threadSafe.h:92
#define DT_DLL_LGRUTIL
Definition: lgrUtil.h:19
LockFunction myLockCallback
The acquire lock callback.
Definition: threadSafe.h:63
DtThreadSafe(const T &value)
! DtThreadSafe Implementation
Definition: threadSafe.h:29
static void unlock(void *object)
Callback function which takes object (down-casts) and unlocks.
Definition: threadSafe.h:215
DtThreadSafe< T > & operator=(const DtThreadSafe< T > &orig)
Locked Copy operator,.
Definition: threadSafe.h:66
Private class that provides a locked call to the const object.
Definition: threadSafe.h:170
void * myObject
The object to pass to the callbacks.
Definition: threadSafe.h:69
DtMutex & myMutex
Definition: threadSafe.h:163
DtMutex & myMutex
Definition: threadSafe.h:187
static void lock(void *object)
Callback function which takes object (down-casts) and locks.
Definition: threadSafe.h:209
SequenceLockImpl(DtThreadSafe *object)
Constructor that takes the object to lock.
Definition: threadSafe.h:197
T * operator->()
Pointer redirect operator.
Definition: threadSafe.h:151
~ConstLockedProxy()
Destructor, releases lock.
Definition: threadSafe.h:181
DtScopedLock myLock
Definition: threadSafe.h:188
const T * operator->()
Pointer redirect operator.
Definition: threadSafe.h:187
Private class that provides a locked call to the object.
Definition: threadSafe.h:146
DtScopedLock myLock
Definition: threadSafe.h:164
Contains IMPORT/EXPORT macros for lgrUtil library.
a thread safe interface to a value.
Definition: threadSafe.h:101
void lockObject()
Lock the external object.
Definition: threadSafe.h:101
virtual ~SequenceLockImpl()
Destructor, does nothing.
Definition: threadSafe.h:203
Private class which implements the Sequence lock.
Definition: threadSafe.h:195
friend class SequenceLockImpl
Definition: threadSafe.h:109
void unlockObject()
Unlock the external object.
Definition: threadSafe.h:111
DtMutex myMutex
The mutex which is used to make the object threadsafe.
Definition: threadSafe.h:227
T myValue
Value which is to be thread safe.
Definition: threadSafe.h:218
DtMutex myLockMutex
The mutex which is used to lock when created the external lock.
Definition: threadSafe.h:224
ConstLockedProxy(const ConstLockedProxy &orig)
Copy Constructor, should not be necessary for optimized code.
Definition: threadSafe.h:171
T * myValue
Definition: threadSafe.h:162