mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 02:25:40 +01:00
Merge pull request #1424 from TheBlueMatt/lockcontention
Fix DEBUG_LOCKCONTENTION
This commit is contained in:
commit
1b7cd74a49
@ -7,6 +7,14 @@
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#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);
|
||||
}
|
||||
#endif /* DEBUG_LOCKCONTENTION */
|
||||
|
||||
#ifdef DEBUG_LOCKORDER
|
||||
//
|
||||
// Early deadlock detection.
|
||||
|
@ -27,6 +27,10 @@ void static inline EnterCritical(const char* pszName, const char* pszFile, int n
|
||||
void static inline LeaveCritical() {}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_LOCKCONTENTION
|
||||
void PrintLockContention(const char* pszName, const char* pszFile, int nLine);
|
||||
#endif
|
||||
|
||||
/** Wrapper around boost::interprocess::scoped_lock */
|
||||
template<typename Mutex>
|
||||
class CMutexLock
|
||||
@ -43,8 +47,7 @@ public:
|
||||
#ifdef DEBUG_LOCKCONTENTION
|
||||
if (!lock.try_lock())
|
||||
{
|
||||
printf("LOCKCONTENTION: %s\n", pszName);
|
||||
printf("Locker: %s:%d\n", pszFile, nLine);
|
||||
PrintLockContention(pszName, pszFile, nLine);
|
||||
#endif
|
||||
lock.lock();
|
||||
#ifdef DEBUG_LOCKCONTENTION
|
||||
|
Loading…
Reference in New Issue
Block a user