Leviathan  0.8.0.0
Leviathan game engine
ThreadSafe.h File Reference
#include "Define.h"
#include <memory>
#include <mutex>
#include <type_traits>

Go to the source code of this file.

Classes

struct  Leviathan::LockTypeResolver< LockType >
 
struct  Leviathan::LockTypeResolver< Mutex >
 
struct  Leviathan::LockTypeResolver< RecursiveMutex >
 
class  Leviathan::Locker
 
class  Leviathan::ThreadSafeGeneric< MutexType >
 Allows the inherited object to be locked. More...
 

Namespaces

 Leviathan
 The access mask controls which registered functions and classes a script sees.
 

Macros

#define GUARD_LOCK()
 
#define GUARD_LOCK_NAME(y)
 
#define GUARD_LOCK_OTHER(x)
 
#define GUARD_LOCK_OTHER(x)
 
#define GUARD_LOCK_OTHER_NAME(x, y)
 
#define REQUIRE_LOCKED(x)   LEVIATHAN_ASSERT(x.owns_lock(), "Mutex doesn't own lock");
 Asserts if lock isn't locked / doesn't own mutex. More...
 

Typedefs

using Leviathan::Mutex = std::mutex
 
using Leviathan::RecursiveMutex = std::recursive_mutex
 
using Leviathan::Lock = std::unique_lock< std::mutex >
 
using Leviathan::RecursiveLock = std::lock_guard< std::recursive_mutex >
 
using Leviathan::ThreadSafe = ThreadSafeGeneric< Mutex >
 Simple lockable objects, no recursive locking. More...
 
using Leviathan::ThreadSafeRecursive = ThreadSafeGeneric< RecursiveMutex >
 Object supports recursive locking. More...
 

Macro Definition Documentation

◆ GUARD_LOCK

#define GUARD_LOCK ( )
Value:
std::remove_reference_t<decltype(Leviathan::Locker::AcessLock(this))>>::LType \
static auto & AcessLock(const ObjectClass *object)
Definition: ThreadSafe.h:55

Definition at line 97 of file ThreadSafe.h.

◆ GUARD_LOCK_NAME

#define GUARD_LOCK_NAME (   y)
Value:
typename Leviathan::LockTypeResolver<std::remove_reference_t<decltype( \
static auto & AcessLock(const ObjectClass *object)
Definition: ThreadSafe.h:55

Definition at line 102 of file ThreadSafe.h.

◆ GUARD_LOCK_OTHER [1/2]

#define GUARD_LOCK_OTHER (   x)
Value:
typename Leviathan::LockTypeResolver<std::remove_reference_t<decltype( \
static auto & AcessLock(const ObjectClass *object)
Definition: ThreadSafe.h:55

Definition at line 110 of file ThreadSafe.h.

◆ GUARD_LOCK_OTHER [2/2]

#define GUARD_LOCK_OTHER (   x)
Value:
typename Leviathan::LockTypeResolver<std::remove_reference_t<decltype( \
static auto & AcessLock(const ObjectClass *object)
Definition: ThreadSafe.h:55

Definition at line 110 of file ThreadSafe.h.

◆ GUARD_LOCK_OTHER_NAME

#define GUARD_LOCK_OTHER_NAME (   x,
 
)
Value:
typename Leviathan::LockTypeResolver<std::remove_reference_t<decltype( \
static auto & AcessLock(const ObjectClass *object)
Definition: ThreadSafe.h:55

Definition at line 113 of file ThreadSafe.h.

◆ REQUIRE_LOCKED

#define REQUIRE_LOCKED (   x)    LEVIATHAN_ASSERT(x.owns_lock(), "Mutex doesn't own lock");

Asserts if lock isn't locked / doesn't own mutex.

Definition at line 118 of file ThreadSafe.h.