From 881a85a22d76c875f519cd54388a419ec6f70857 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Wed, 18 Sep 2013 20:38:08 +1000 Subject: Replace printf with LogPrintf / LogPrint --- src/sync.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/sync.cpp') diff --git a/src/sync.cpp b/src/sync.cpp index 1ac4403beb..29a455f9b2 100644 --- a/src/sync.cpp +++ b/src/sync.cpp @@ -10,8 +10,8 @@ #ifdef DEBUG_LOCKCONTENTION void PrintLockContention(const char* pszName, const char* pszFile, int nLine) { - printf("LOCKCONTENTION: %s\n", pszName); - printf("Locker: %s:%d\n", pszFile, nLine); + LogPrintf("LOCKCONTENTION: %s\n", pszName); + LogPrintf("Locker: %s:%d\n", pszFile, nLine); } #endif /* DEBUG_LOCKCONTENTION */ @@ -56,20 +56,20 @@ static boost::thread_specific_ptr lockstack; static void potential_deadlock_detected(const std::pair& mismatch, const LockStack& s1, const LockStack& s2) { - printf("POTENTIAL DEADLOCK DETECTED\n"); - printf("Previous lock order was:\n"); + LogPrintf("POTENTIAL DEADLOCK DETECTED\n"); + LogPrintf("Previous lock order was:\n"); BOOST_FOREACH(const PAIRTYPE(void*, CLockLocation)& i, s2) { - if (i.first == mismatch.first) printf(" (1)"); - if (i.first == mismatch.second) printf(" (2)"); - printf(" %s\n", i.second.ToString().c_str()); + if (i.first == mismatch.first) LogPrintf(" (1)"); + if (i.first == mismatch.second) LogPrintf(" (2)"); + LogPrintf(" %s\n", i.second.ToString().c_str()); } - printf("Current lock order is:\n"); + LogPrintf("Current lock order is:\n"); BOOST_FOREACH(const PAIRTYPE(void*, CLockLocation)& i, s1) { - if (i.first == mismatch.first) printf(" (1)"); - if (i.first == mismatch.second) printf(" (2)"); - printf(" %s\n", i.second.ToString().c_str()); + if (i.first == mismatch.first) LogPrintf(" (1)"); + if (i.first == mismatch.second) LogPrintf(" (2)"); + LogPrintf(" %s\n", i.second.ToString().c_str()); } } @@ -78,7 +78,7 @@ static void push_lock(void* c, const CLockLocation& locklocation, bool fTry) if (lockstack.get() == NULL) lockstack.reset(new LockStack); - if (fDebug) printf("Locking: %s\n", locklocation.ToString().c_str()); + if (fDebug) LogPrintf("Locking: %s\n", locklocation.ToString().c_str()); dd_mutex.lock(); (*lockstack).push_back(std::make_pair(c, locklocation)); @@ -108,7 +108,7 @@ static void pop_lock() if (fDebug) { const CLockLocation& locklocation = (*lockstack).rbegin()->second; - printf("Unlocked: %s\n", locklocation.ToString().c_str()); + LogPrintf("Unlocked: %s\n", locklocation.ToString().c_str()); } dd_mutex.lock(); (*lockstack).pop_back(); -- cgit v1.2.3