Use template function instead of void* parameter
This change gets rid of -Wthread-safety-attributes warning spam.
This commit is contained in:
parent
dfb75ae49d
commit
971a468ccf
|
@ -219,12 +219,15 @@ static bool LockHeld(void* mutex)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine, void* cs)
|
template <typename MutexType>
|
||||||
|
void AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine, MutexType* cs)
|
||||||
{
|
{
|
||||||
if (LockHeld(cs)) return;
|
if (LockHeld(cs)) return;
|
||||||
tfm::format(std::cerr, "Assertion failed: lock %s not held in %s:%i; locks held:\n%s", pszName, pszFile, nLine, LocksHeld());
|
tfm::format(std::cerr, "Assertion failed: lock %s not held in %s:%i; locks held:\n%s", 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, int nLine, void* cs)
|
void AssertLockNotHeldInternal(const char* pszName, const char* pszFile, int nLine, void* cs)
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,7 +52,8 @@ void EnterCritical(const char* pszName, const char* pszFile, int nLine, void* cs
|
||||||
void LeaveCritical();
|
void LeaveCritical();
|
||||||
void CheckLastCritical(void* cs, std::string& lockname, const char* guardname, const char* file, int line);
|
void CheckLastCritical(void* cs, std::string& lockname, const char* guardname, const char* file, int line);
|
||||||
std::string LocksHeld();
|
std::string LocksHeld();
|
||||||
void AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine, void* cs) ASSERT_EXCLUSIVE_LOCK(cs);
|
template <typename MutexType>
|
||||||
|
void AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine, MutexType* cs) ASSERT_EXCLUSIVE_LOCK(cs);
|
||||||
void AssertLockNotHeldInternal(const char* pszName, const char* pszFile, int nLine, void* cs);
|
void AssertLockNotHeldInternal(const char* pszName, const char* pszFile, int nLine, void* cs);
|
||||||
void DeleteLock(void* cs);
|
void DeleteLock(void* cs);
|
||||||
|
|
||||||
|
@ -66,7 +67,8 @@ extern bool g_debug_lockorder_abort;
|
||||||
void static inline EnterCritical(const char* pszName, const char* pszFile, int nLine, void* cs, bool fTry = false) {}
|
void static inline EnterCritical(const char* pszName, const char* pszFile, int nLine, void* cs, bool fTry = false) {}
|
||||||
void static inline LeaveCritical() {}
|
void static inline LeaveCritical() {}
|
||||||
void static inline CheckLastCritical(void* cs, std::string& lockname, const char* guardname, const char* file, int line) {}
|
void static inline CheckLastCritical(void* cs, std::string& lockname, const char* guardname, const char* file, int line) {}
|
||||||
void static inline AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine, void* cs) ASSERT_EXCLUSIVE_LOCK(cs) {}
|
template <typename MutexType>
|
||||||
|
void static inline AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine, MutexType* cs) ASSERT_EXCLUSIVE_LOCK(cs) {}
|
||||||
void static inline AssertLockNotHeldInternal(const char* pszName, const char* pszFile, int nLine, void* cs) {}
|
void static inline AssertLockNotHeldInternal(const char* pszName, const char* pszFile, int nLine, void* cs) {}
|
||||||
void static inline DeleteLock(void* cs) {}
|
void static inline DeleteLock(void* cs) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue