1 #ifndef GAUDIKERNEL_LOCKEDHANDLE 2 #define GAUDIKERNEL_LOCKEDHANDLE 1 27 template <
class T,
class MutexType = std::mutex>
36 void set( T* ptr, MutexType* mut )
44 T*
get()
const {
return m_ptr; }
58 operator T&() {
return *
m_ptr; }
77 operator const T&()
const {
return *
m_ptr; }
96 operator bool()
const {
return m_ptr; }
Guard operator->()
Aquire and release the lock before and after the object is accessed.
Guard(const Guard &a)=delete
Guard(T *ptr, MutexType &mutex)
ConstGuard(const T *ptr, MutexType &mutex)
ConstGuard operator*() const
Aquire and release the lock before and after the const object is accessed.
const T * operator->() const
Provides automatic lock/unlock access to a class upon deref of ptr.
LockedHandle(T *ptr, MutexType *mut)
Guard operator*()
Aquire and release the lock before and after the object is accessed.
LockedHandle(T *ptr, MutexType &mut)
ConstGuard(ConstGuard &&a)
const T & operator*() const
void setMutex(MutexType *mut)
ConstGuard operator->() const
Aquire and release the lock before and after the const object is accessed.