diff --git a/src/sync.h b/src/sync.h --- a/src/sync.h +++ b/src/sync.h @@ -53,8 +53,9 @@ void CheckLastCritical(void *cs, std::string &lockname, const char *guardname, const char *file, int line); std::string LocksHeld(); +template void AssertLockHeldInternal(const char *pszName, const char *pszFile, int nLine, - void *cs) ASSERT_EXCLUSIVE_LOCK(cs); + MutexType *cs) ASSERT_EXCLUSIVE_LOCK(cs); void AssertLockNotHeldInternal(const char *pszName, const char *pszFile, int nLine, void *cs); void DeleteLock(void *cs); @@ -72,9 +73,11 @@ static inline void CheckLastCritical(void *cs, std::string &lockname, const char *guardname, const char *file, int line) {} +template static inline void AssertLockHeldInternal(const char *pszName, const char *pszFile, int nLine, - void *cs) ASSERT_EXCLUSIVE_LOCK(cs) {} + MutexType *cs) + ASSERT_EXCLUSIVE_LOCK(cs) {} static inline void AssertLockNotHeldInternal(const char *pszName, const char *pszFile, int nLine, void *cs) {} diff --git a/src/sync.cpp b/src/sync.cpp --- a/src/sync.cpp +++ b/src/sync.cpp @@ -218,8 +218,9 @@ return false; } +template void AssertLockHeldInternal(const char *pszName, const char *pszFile, int nLine, - void *cs) { + MutexType *cs) { if (LockHeld(cs)) { return; } @@ -228,6 +229,9 @@ pszName, pszFile, nLine, LocksHeld()); 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, int nLine, void *cs) {