mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 14:08:40 +01:00
Put lock logging behind DEBUG_LOCKCONTENTION preprocessor directive
This commit is contained in:
@@ -6,8 +6,11 @@
|
||||
#ifndef BITCOIN_SYNC_H
|
||||
#define BITCOIN_SYNC_H
|
||||
|
||||
#ifdef DEBUG_LOCKCONTENTION
|
||||
#include <logging.h>
|
||||
#include <logging/timer.h>
|
||||
#endif
|
||||
|
||||
#include <threadsafety.h>
|
||||
#include <util/macros.h>
|
||||
|
||||
@@ -136,8 +139,10 @@ private:
|
||||
void Enter(const char* pszName, const char* pszFile, int nLine)
|
||||
{
|
||||
EnterCritical(pszName, pszFile, nLine, Base::mutex());
|
||||
#ifdef DEBUG_LOCKCONTENTION
|
||||
if (Base::try_lock()) return;
|
||||
LOG_TIME_MICROS_WITH_CATEGORY(strprintf("lock contention %s, %s:%d", pszName, pszFile, nLine), BCLog::LOCK);
|
||||
#endif
|
||||
Base::lock();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user