Template Class LockedRef

Class Documentation

template<typename T, class Mutex>
class LockedRef

The LockedRef class is used to share a pointer to an object and a mutex that protects the read/write access to that object.

As long as the object remains in scope, the mutex is locked, therefore you must destroy this object as soon as the pointer was used.

Public Functions

LockedRef() = default
inline LockedRef(T *obj, Mutex *obj_mutex)
inline ~LockedRef()
LockedRef(LockedRef const&) = delete
LockedRef &operator=(LockedRef const&) = delete
inline LockedRef(LockedRef &&other)
inline LockedRef &operator=(LockedRef &&other)
inline operator bool() const
inline void lock()
inline void unlock()
inline bool empty() const
inline const T &operator()() const
inline T &operator()()