aboutsummaryrefslogtreecommitdiff
path: root/src/sync.cpp
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2020-05-28 09:55:04 +0300
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2020-05-28 09:55:04 +0300
commit971a468ccf0474ca00fa7d20278569b8fb11f0fb (patch)
treec2e37c99581fee3f716fe77faee3921b63969cb4 /src/sync.cpp
parentdfb75ae49d4d617ec02188a6f449e8b8015ad467 (diff)
downloadbitcoin-971a468ccf0474ca00fa7d20278569b8fb11f0fb.tar.xz
Use template function instead of void* parameter
This change gets rid of -Wthread-safety-attributes warning spam.
Diffstat (limited to 'src/sync.cpp')
-rw-r--r--src/sync.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/sync.cpp b/src/sync.cpp
index c3312b5a00..9abdedbed4 100644
--- a/src/sync.cpp
+++ b/src/sync.cpp
@@ -219,12 +219,15 @@ static bool LockHeld(void* mutex)
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;
tfm::format(std::cerr, "Assertion failed: lock %s not held in %s:%i; locks held:\n%s", 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)
{