aboutsummaryrefslogtreecommitdiff
path: root/src/sync.cpp
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2014-02-18 12:11:46 -0500
committerGavin Andresen <gavinandresen@gmail.com>2014-02-18 12:11:46 -0500
commitca4cf5cff6fb60c9769b62acce2e3a8fcd0e7aae (patch)
tree87a92041e1d394ad06d8506be036973f5b5e0fd4 /src/sync.cpp
parent5c9932345976de17b1a02401162466995d8355e3 (diff)
downloadbitcoin-ca4cf5cff6fb60c9769b62acce2e3a8fcd0e7aae.tar.xz
Wallet locking fixes for -DDEBUG_LOCKORDER
Compiling with -DDEBUG_LOCKORDER and running the qa/rpc-test/ regression tests uncovered a couple of wallet methods that should (but didn't) acquire the cs_wallet mutext. I also changed the AssertLockHeld() routine print to stderr and abort, instead of printing to debug.log and then assert()'ing. It is annoying to look in debug.log to find out which AssertLockHeld is failing.
Diffstat (limited to 'src/sync.cpp')
-rw-r--r--src/sync.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/sync.cpp b/src/sync.cpp
index 8f713807f7..e624a9ee84 100644
--- a/src/sync.cpp
+++ b/src/sync.cpp
@@ -140,8 +140,9 @@ void AssertLockHeldInternal(const char *pszName, const char* pszFile, int nLine,
{
BOOST_FOREACH(const PAIRTYPE(void*, CLockLocation)&i, *lockstack)
if (i.first == cs) return;
- LogPrintf("Lock %s not held in %s:%i; locks held:\n%s", pszName, pszFile, nLine, LocksHeld());
- assert(0);
+ fprintf(stderr, "Assertion failed: lock %s not held in %s:%i; locks held:\n%s",
+ pszName, pszFile, nLine, LocksHeld().c_str());
+ abort();
}
#endif /* DEBUG_LOCKORDER */