Leviathan  0.8.0.0
Leviathan game engine
Leviathan::ThreadSafeGeneric< MutexType > Class Template Reference

Allows the inherited object to be locked. More...

#include <ThreadSafe.h>

+ Inheritance diagram for Leviathan::ThreadSafeGeneric< MutexType >:

Public Member Functions

DLLEXPORT ThreadSafeGeneric ()
 
DLLEXPORT ~ThreadSafeGeneric ()
 
FORCE_INLINE void VerifyLock (RecursiveLock &guard) const
 
FORCE_INLINE void VerifyLock (Lock &lockit) const
 

Protected Attributes

MutexType ObjectsLock
 

Detailed Description

template<class MutexType>
class Leviathan::ThreadSafeGeneric< MutexType >

Allows the inherited object to be locked.

Note
Not allowed to be used as a pointer type

Definition at line 123 of file ThreadSafe.h.

Constructor & Destructor Documentation

◆ ThreadSafeGeneric()

template<class MutexType >
DLLEXPORT Leviathan::ThreadSafeGeneric< MutexType >::ThreadSafeGeneric ( )
inline

Definition at line 125 of file ThreadSafe.h.

125 {}

◆ ~ThreadSafeGeneric()

template<class MutexType >
DLLEXPORT Leviathan::ThreadSafeGeneric< MutexType >::~ThreadSafeGeneric ( )
inline

Definition at line 126 of file ThreadSafe.h.

126 {}

Member Function Documentation

◆ VerifyLock() [1/2]

template<class MutexType >
FORCE_INLINE void Leviathan::ThreadSafeGeneric< MutexType >::VerifyLock ( RecursiveLock guard) const
inline

Definition at line 128 of file ThreadSafe.h.

129  {
130  // Apparently there is no way to verify this...
131  // if(!guard.owns_lock(&this->ObjectsLock))
132  // throw InvalidAccess("wrong lock owner");
133  }

◆ VerifyLock() [2/2]

template<class MutexType >
FORCE_INLINE void Leviathan::ThreadSafeGeneric< MutexType >::VerifyLock ( Lock lockit) const
inline

Definition at line 135 of file ThreadSafe.h.

136  {
137  // Make sure that the lock is locked //
138  LEVIATHAN_ASSERT(lockit.owns_lock(), "lock not locked");
139  }

Member Data Documentation

◆ ObjectsLock

template<class MutexType >
MutexType Leviathan::ThreadSafeGeneric< MutexType >::ObjectsLock
mutableprotected

The main lock facility, mutable for working with const functions

Note
Even though this is not protected it should not be abused

Definition at line 144 of file ThreadSafe.h.


The documentation for this class was generated from the following file: