Changeset View
Changeset View
Standalone View
Standalone View
src/sync.cpp
Show First 20 Lines • Show All 212 Lines • ▼ Show 20 Lines | for (const LockStackItem &i : lock_stack) { | ||||
if (i.first == mutex) { | if (i.first == mutex) { | ||||
return true; | return true; | ||||
} | } | ||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
template <typename MutexType> | |||||
void AssertLockHeldInternal(const char *pszName, const char *pszFile, int nLine, | void AssertLockHeldInternal(const char *pszName, const char *pszFile, int nLine, | ||||
void *cs) { | MutexType *cs) { | ||||
if (LockHeld(cs)) { | if (LockHeld(cs)) { | ||||
return; | return; | ||||
} | } | ||||
tfm::format(std::cerr, | tfm::format(std::cerr, | ||||
"Assertion failed: lock %s not held in %s:%i; locks held:\n%s", | "Assertion failed: lock %s not held in %s:%i; locks held:\n%s", | ||||
pszName, pszFile, nLine, LocksHeld()); | pszName, pszFile, nLine, LocksHeld()); | ||||
abort(); | abort(); | ||||
} | } | ||||
template void AssertLockHeldInternal(const char *, const char *, int, Mutex *); | |||||
template void AssertLockHeldInternal(const char *, const char *, int, | |||||
RecursiveMutex *); | |||||
void AssertLockNotHeldInternal(const char *pszName, const char *pszFile, | void AssertLockNotHeldInternal(const char *pszName, const char *pszFile, | ||||
int nLine, void *cs) { | int nLine, void *cs) { | ||||
if (!LockHeld(cs)) { | if (!LockHeld(cs)) { | ||||
return; | return; | ||||
} | } | ||||
tfm::format(std::cerr, | tfm::format(std::cerr, | ||||
"Assertion failed: lock %s held in %s:%i; locks held:\n%s", | "Assertion failed: lock %s held in %s:%i; locks held:\n%s", | ||||
Show All 26 Lines |