aboutsummaryrefslogtreecommitdiff
path: root/src/sync.cpp
diff options
context:
space:
mode:
authorRussell Yanofsky <[email protected]>2017-11-08 15:28:35 -0500
committerRussell Yanofsky <[email protected]>2018-08-03 07:11:37 -0500
commit41b88e93375d57db12da923f45f87b9a2db8e730 (patch)
treeca184f2dbeea04b7deea7f7f3dc5a73d66d51795 /src/sync.cpp
parentMerge #13849: travis: use only travis jobs: instead of mix of jobs+matrix (diff)
downloaddiscoin-41b88e93375d57db12da923f45f87b9a2db8e730.tar.xz
discoin-41b88e93375d57db12da923f45f87b9a2db8e730.zip
Add unit test for DEBUG_LOCKORDER code
Diffstat (limited to 'src/sync.cpp')
-rw-r--r--src/sync.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/sync.cpp b/src/sync.cpp
index 28a4e37e6..96ea61b21 100644
--- a/src/sync.cpp
+++ b/src/sync.cpp
@@ -100,7 +100,11 @@ static void potential_deadlock_detected(const std::pair<void*, void*>& mismatch,
}
LogPrintf(" %s\n", i.second.ToString());
}
- assert(false);
+ if (g_debug_lockorder_abort) {
+ fprintf(stderr, "Assertion failed: detected inconsistent lock order at %s:%i, details in debug log.\n", __FILE__, __LINE__);
+ abort();
+ }
+ throw std::logic_error("potential deadlock detected");
}
static void push_lock(void* c, const CLockLocation& locklocation)
@@ -189,4 +193,6 @@ void DeleteLock(void* cs)
}
}
+bool g_debug_lockorder_abort = true;
+
#endif /* DEBUG_LOCKORDER */