#include <threadsafety.h>
#include <condition_variable>
#include <thread>
#include <mutex>
Go to the source code of this file.
|
#define | AssertLockHeld(cs) AssertLockHeldInternal(#cs, __FILE__, __LINE__, &cs) |
|
#define | AssertLockNotHeld(cs) AssertLockNotHeldInternal(#cs, __FILE__, __LINE__, &cs) |
|
#define | PASTE(x, y) x ## y |
|
#define | PASTE2(x, y) PASTE(x, y) |
|
#define | LOCK(cs) DebugLock<decltype(cs)> PASTE2(criticalblock, __COUNTER__)(cs, #cs, __FILE__, __LINE__) |
|
#define | LOCK2(cs1, cs2) |
|
#define | TRY_LOCK(cs, name) DebugLock<decltype(cs)> name(cs, #cs, __FILE__, __LINE__, true) |
|
#define | WAIT_LOCK(cs, name) DebugLock<decltype(cs)> name(cs, #cs, __FILE__, __LINE__) |
|
#define | ENTER_CRITICAL_SECTION(cs) |
|
#define | LEAVE_CRITICAL_SECTION(cs) |
|
#define | WITH_LOCK(cs, code) [&] { LOCK(cs); code; }() |
|
|
static void | EnterCritical (const char *pszName, const char *pszFile, int nLine, void *cs, bool fTry=false) |
|
static void | LeaveCritical () |
|
static void | AssertLockHeldInternal (const char *pszName, const char *pszFile, int nLine, void *cs) ASSERT_EXCLUSIVE_LOCK(cs) |
|
static void | AssertLockNotHeldInternal (const char *pszName, const char *pszFile, int nLine, void *cs) |
|
static void | DeleteLock (void *cs) |
|
◆ AssertLockHeld
◆ AssertLockNotHeld
◆ ENTER_CRITICAL_SECTION
#define ENTER_CRITICAL_SECTION |
( |
|
cs | ) |
|
Value:{ \
EnterCritical(#
cs, __FILE__, __LINE__, (
void*)(&
cs)); \
}
static void pool cs
Definition: mempool_eviction.cpp:13
◆ LEAVE_CRITICAL_SECTION
#define LEAVE_CRITICAL_SECTION |
( |
|
cs | ) |
|
Value:{ \
LeaveCritical(); \
}
static void pool cs
Definition: mempool_eviction.cpp:13
◆ LOCK
◆ LOCK2
#define LOCK2 |
( |
|
cs1, |
|
|
|
cs2 |
|
) |
| |
Value:DebugLock<decltype(cs1)> criticalblock1(cs1, #cs1, __FILE__, __LINE__); \
DebugLock<decltype(cs2)> criticalblock2(cs2, #cs2, __FILE__, __LINE__);
◆ PASTE
#define PASTE |
( |
|
x, |
|
|
|
y |
|
) |
| x ## y |
◆ PASTE2
#define PASTE2 |
( |
|
x, |
|
|
|
y |
|
) |
| PASTE(x, y) |
◆ TRY_LOCK
◆ WAIT_LOCK
◆ WITH_LOCK
#define WITH_LOCK |
( |
|
cs, |
|
|
|
code |
|
) |
| [&] { LOCK(cs); code; }() |
◆ CCriticalSection
◆ DebugLock
template<typename MutexArg >
using DebugLock = UniqueLock<typename std::remove_reference<typename std::remove_pointer<MutexArg>::type>::type> |
◆ Mutex
Wrapped mutex: supports waiting but not recursive locking
◆ RecursiveMutex
Wrapped mutex: supports recursive locking, but no waiting TODO: We should move away from using the recursive lock by default.
◆ AssertLockHeldInternal()
static void AssertLockHeldInternal |
( |
const char * |
pszName, |
|
|
const char * |
pszFile, |
|
|
int |
nLine, |
|
|
void * |
cs |
|
) |
| |
|
inlinestatic |
◆ AssertLockNotHeldInternal()
static void AssertLockNotHeldInternal |
( |
const char * |
pszName, |
|
|
const char * |
pszFile, |
|
|
int |
nLine, |
|
|
void * |
cs |
|
) |
| |
|
inlinestatic |
◆ DeleteLock()
static void DeleteLock |
( |
void * |
cs | ) |
|
|
inlinestatic |
◆ EnterCritical()
static void EnterCritical |
( |
const char * |
pszName, |
|
|
const char * |
pszFile, |
|
|
int |
nLine, |
|
|
void * |
cs, |
|
|
bool |
fTry = false |
|
) |
| |
|
inlinestatic |
◆ LeaveCritical()
static void LeaveCritical |
( |
| ) |
|
|
inlinestatic |