#include <threadsafety.h>
#include <util/macros.h>
#include <condition_variable>
#include <mutex>
#include <string>
#include <thread>
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 | REVERSE_LOCK(g) typename std::decay<decltype(g)>::type::reverse_lock PASTE2(revlock, __COUNTER__)(g, #g, __FILE__, __LINE__) |
| |
| #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; }() |
| | Run code while locking a mutex. More...
|
| |
|
| using | RecursiveMutex = AnnotatedMixin< std::recursive_mutex > |
| | Wrapped mutex: supports recursive locking, but no waiting TODO: We should move away from using the recursive lock by default. More...
|
| |
typedef AnnotatedMixin
< std::mutex > | Mutex |
| | Wrapped mutex: supports waiting but not recursive locking. More...
|
| |
| template<typename MutexArg > |
| using | DebugLock = UniqueLock< typename std::remove_reference< typename std::remove_pointer< MutexArg >::type >::type > |
| |
|
| void | EnterCritical (const char *pszName, const char *pszFile, int nLine, void *cs, bool fTry=false) |
| |
| void | LeaveCritical () |
| |
| void | CheckLastCritical (void *cs, std::string &lockname, const char *guardname, const char *file, int line) |
| |
| template<typename MutexType > |
| void | AssertLockHeldInternal (const char *pszName, const char *pszFile, int nLine, MutexType *cs) EXCLUSIVE_LOCKS_REQUIRED(cs) |
| |
| template<typename MutexType > |
| void | AssertLockNotHeldInternal (const char *pszName, const char *pszFile, int nLine, MutexType *cs) EXCLUSIVE_LOCKS_REQUIRED(!cs) |
| |
| void | DeleteLock (void *cs) |
| |
| bool | LockStackEmpty () |
| |
| #define ENTER_CRITICAL_SECTION |
( |
|
cs | ) |
|
Value:
}
void EnterCritical(const char *pszName, const char *pszFile, int nLine, void *cs, bool fTry=false)
Definition at line 237 of file sync.h.
| #define LEAVE_CRITICAL_SECTION |
( |
|
cs | ) |
|
Value:
Definition at line 243 of file sync.h.
| #define LOCK2 |
( |
|
cs1, |
|
|
|
cs2 |
|
) |
| |
Value:
DebugLock<decltype(cs2)> criticalblock2(cs2, #cs2, __FILE__, __LINE__);
Wrapper around std::unique_lock style lock for Mutex.
Definition at line 231 of file sync.h.
| #define REVERSE_LOCK |
( |
|
g | ) |
typename std::decay<decltype(g)>::type::reverse_lock PASTE2(revlock, __COUNTER__)(g, #g, __FILE__, __LINE__) |
| #define WITH_LOCK |
( |
|
cs, |
|
|
|
code |
|
) |
| [&] { LOCK(cs); code; }() |
template<typename MutexArg >
| using DebugLock = UniqueLock<typename std::remove_reference<typename std::remove_pointer<MutexArg>::type>::type> |
Wrapped mutex: supports waiting but not recursive locking.
Definition at line 125 of file sync.h.
Wrapped mutex: supports recursive locking, but no waiting TODO: We should move away from using the recursive lock by default.
Definition at line 122 of file sync.h.
template<typename MutexType >
| void AssertLockHeldInternal |
( |
const char * |
pszName, |
|
|
const char * |
pszFile, |
|
|
int |
nLine, |
|
|
MutexType * |
cs |
|
) |
| |
|
inline |
template<typename MutexType >
| void AssertLockNotHeldInternal |
( |
const char * |
pszName, |
|
|
const char * |
pszFile, |
|
|
int |
nLine, |
|
|
MutexType * |
cs |
|
) |
| |
| void CheckLastCritical |
( |
void * |
cs, |
|
|
std::string & |
lockname, |
|
|
const char * |
guardname, |
|
|
const char * |
file, |
|
|
int |
line |
|
) |
| |
|
inline |
| void DeleteLock |
( |
void * |
cs | ) |
|
|
inline |
| void EnterCritical |
( |
const char * |
pszName, |
|
|
const char * |
pszFile, |
|
|
int |
nLine, |
|
|
void * |
cs, |
|
|
bool |
fTry = false |
|
) |
| |
|
inline |