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 Types

using LockT = typename LockTypeResolver< MutexType >::LType
 

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 137 of file ThreadSafe.h.

Member Typedef Documentation

◆ LockT

template<class MutexType >
using Leviathan::ThreadSafeGeneric< MutexType >::LockT = typename LockTypeResolver<MutexType>::LType

Definition at line 139 of file ThreadSafe.h.

Constructor & Destructor Documentation

◆ ThreadSafeGeneric()

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

Definition at line 141 of file ThreadSafe.h.

141 {}

◆ ~ThreadSafeGeneric()

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

Definition at line 142 of file ThreadSafe.h.

142 {}

Member Function Documentation

◆ VerifyLock() [1/2]

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

Definition at line 144 of file ThreadSafe.h.

145  {
146  // Apparently there is no way to verify this...
147  // if(!guard.owns_lock(&this->ObjectsLock))
148  // throw InvalidAccess("wrong lock owner");
149  }

◆ VerifyLock() [2/2]

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

Definition at line 151 of file ThreadSafe.h.

152  {
153  // Make sure that the lock is locked //
154  LEVIATHAN_ASSERT(lockit.owns_lock(), "lock not locked");
155  }
#define LEVIATHAN_ASSERT(x, msg)
Definition: Define.h:102

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 160 of file ThreadSafe.h.


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