diff options
| author | Matt Corallo <[email protected]> | 2017-01-17 17:42:46 -0500 |
|---|---|---|
| committer | Matt Corallo <[email protected]> | 2017-10-13 19:29:54 -0400 |
| commit | 2b4b34503ff0ed44365d83a68ffed2736ea9cc51 (patch) | |
| tree | 62462c66263e297f19d6b1de7a24f91acfab8093 /src/sync.cpp | |
| parent | Call TransactionRemovedFromMempool in the CScheduler thread (diff) | |
| download | discoin-2b4b34503ff0ed44365d83a68ffed2736ea9cc51.tar.xz discoin-2b4b34503ff0ed44365d83a68ffed2736ea9cc51.zip | |
Add ability to assert a lock is not held in DEBUG_LOCKORDER
Diffstat (limited to 'src/sync.cpp')
| -rw-r--r-- | src/sync.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/sync.cpp b/src/sync.cpp index 87024ccdf..4ef419cd0 100644 --- a/src/sync.cpp +++ b/src/sync.cpp @@ -155,6 +155,16 @@ void AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine, abort(); } +void AssertLockNotHeldInternal(const char* pszName, const char* pszFile, int nLine, void* cs) +{ + for (const std::pair<void*, CLockLocation>& i : *lockstack) { + if (i.first == cs) { + fprintf(stderr, "Assertion failed: lock %s held in %s:%i; locks held:\n%s", pszName, pszFile, nLine, LocksHeld().c_str()); + abort(); + } + } +} + void DeleteLock(void* cs) { if (!lockdata.available) { |