aboutsummaryrefslogtreecommitdiff
path: root/src/sync.cpp
diff options
context:
space:
mode:
authorAnthony Towns <[email protected]>2020-08-06 02:55:31 +1000
committerHennadii Stepanov <[email protected]>2020-08-29 20:46:47 +0300
commit2ee7743fe723227f2ea1b031eddb14fc6863f4c8 (patch)
tree65bce22427bcb9addb344982545af9abfe75ada5 /src/sync.cpp
parentDo not hide compile-time thread safety warnings (diff)
downloaddiscoin-2ee7743fe723227f2ea1b031eddb14fc6863f4c8.tar.xz
discoin-2ee7743fe723227f2ea1b031eddb14fc6863f4c8.zip
sync.h: Make runtime lock checks require compile-time lock checks
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 4be13a3c4..322198a85 100644
--- a/src/sync.cpp
+++ b/src/sync.cpp
@@ -238,12 +238,15 @@ void AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine,
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)
+template <typename MutexType>
+void AssertLockNotHeldInternal(const char* pszName, const char* pszFile, int nLine, MutexType* cs)
{
if (!LockHeld(cs)) return;
tfm::format(std::cerr, "Assertion failed: lock %s held in %s:%i; locks held:\n%s", pszName, pszFile, nLine, LocksHeld());
abort();
}
+template void AssertLockNotHeldInternal(const char*, const char*, int, Mutex*);
+template void AssertLockNotHeldInternal(const char*, const char*, int, RecursiveMutex*);
void DeleteLock(void* cs)
{