Changeset View
Changeset View
Standalone View
Standalone View
src/sync.cpp
Show First 20 Lines • Show All 237 Lines • ▼ Show 20 Lines | 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, Mutex *); | ||||
template void AssertLockHeldInternal(const char *, const char *, int, | template void AssertLockHeldInternal(const char *, const char *, int, | ||||
RecursiveMutex *); | RecursiveMutex *); | ||||
template <typename MutexType> | |||||
void AssertLockNotHeldInternal(const char *pszName, const char *pszFile, | void AssertLockNotHeldInternal(const char *pszName, const char *pszFile, | ||||
int nLine, void *cs) { | int nLine, MutexType *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", | ||||
pszName, pszFile, nLine, LocksHeld()); | pszName, pszFile, nLine, LocksHeld()); | ||||
abort(); | abort(); | ||||
} | } | ||||
template void AssertLockNotHeldInternal(const char *, const char *, int, | |||||
Mutex *); | |||||
template void AssertLockNotHeldInternal(const char *, const char *, int, | |||||
RecursiveMutex *); | |||||
void DeleteLock(void *cs) { | void DeleteLock(void *cs) { | ||||
LockData &lockdata = GetLockData(); | LockData &lockdata = GetLockData(); | ||||
std::lock_guard<std::mutex> lock(lockdata.dd_mutex); | std::lock_guard<std::mutex> lock(lockdata.dd_mutex); | ||||
const LockPair item = std::make_pair(cs, nullptr); | const LockPair item = std::make_pair(cs, nullptr); | ||||
LockOrders::iterator it = lockdata.lockorders.lower_bound(item); | LockOrders::iterator it = lockdata.lockorders.lower_bound(item); | ||||
while (it != lockdata.lockorders.end() && it->first.first == cs) { | while (it != lockdata.lockorders.end() && it->first.first == cs) { | ||||
const LockPair invitem = | const LockPair invitem = | ||||
Show All 25 Lines |