aboutsummaryrefslogtreecommitdiff
path: root/src/sync.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2013-12-19 09:09:51 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2013-12-19 09:46:11 +0100
commit19a5676280370148492cf59a5103584cf37893ac (patch)
treecc3212d12ff9799fc0d5633b289d1832cb0915d0 /src/sync.h
parent636a42bd0e208d1d49dab6a95e23863736823883 (diff)
downloadbitcoin-19a5676280370148492cf59a5103584cf37893ac.tar.xz
Use mutex pointer instead of name for AssertLockHeld
This makes it useable for non-global locks such as the wallet and keystore locks.
Diffstat (limited to 'src/sync.h')
-rw-r--r--src/sync.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/sync.h b/src/sync.h
index c50abf81b6..077ed59b89 100644
--- a/src/sync.h
+++ b/src/sync.h
@@ -88,12 +88,13 @@ typedef AnnotatedMixin<boost::mutex> CWaitableCriticalSection;
void EnterCritical(const char* pszName, const char* pszFile, int nLine, void* cs, bool fTry = false);
void LeaveCritical();
std::string LocksHeld();
-void AssertLockHeld(std::string strName);
+void AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine, void *cs);
#else
void static inline EnterCritical(const char* pszName, const char* pszFile, int nLine, void* cs, bool fTry = false) {}
void static inline LeaveCritical() {}
-void static inline AssertLockHeld(std::string) {}
+void static inline AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine, void *cs) {}
#endif
+#define AssertLockHeld(cs) AssertLockHeldInternal(#cs, __FILE__, __LINE__, &cs)
#ifdef DEBUG_LOCKCONTENTION
void PrintLockContention(const char* pszName, const char* pszFile, int nLine);