From: Pieter Wuille Date: Sat, 7 Apr 2012 16:29:31 +0000 (+0200) Subject: Support for parametrized locks in deadlock detector X-Git-Tag: v0.4.0-unstable~129^2~96^2~1 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=908037fe16843aa354f63af8f14804821aaf70f1 Support for parametrized locks in deadlock detector --- diff --git a/src/util.cpp b/src/util.cpp index fd4847b..17442a3 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1115,25 +1115,25 @@ private: int sourceLine; }; -typedef std::vector< std::pair > LockStack; +typedef std::vector< std::pair > LockStack; static boost::interprocess::interprocess_mutex dd_mutex; -static std::map, LockStack> lockorders; +static std::map, LockStack> lockorders; static boost::thread_specific_ptr lockstack; -static void potential_deadlock_detected(const std::pair& mismatch, const LockStack& s1, const LockStack& s2) +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"); - BOOST_FOREACH(const PAIRTYPE(CCriticalSection*, CLockLocation)& i, s2) + 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()); } printf("Current lock order is:\n"); - BOOST_FOREACH(const PAIRTYPE(CCriticalSection*, CLockLocation)& i, s1) + BOOST_FOREACH(const PAIRTYPE(void*, CLockLocation)& i, s1) { if (i.first == mismatch.first) printf(" (1)"); if (i.first == mismatch.second) printf(" (2)"); @@ -1141,7 +1141,7 @@ static void potential_deadlock_detected(const std::pair p1 = std::make_pair(i.first, c); + std::pair p1 = std::make_pair(i.first, c); if (lockorders.count(p1)) continue; lockorders[p1] = (*lockstack); - std::pair p2 = std::make_pair(c, i.first); + std::pair p2 = std::make_pair(c, i.first); if (lockorders.count(p2)) { potential_deadlock_detected(p1, lockorders[p2], lockorders[p1]);