diff options
author | Jon Atack <jon@atack.com> | 2022-04-01 12:23:01 +0200 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2022-04-08 13:26:34 +0100 |
commit | 6374e24887e3957cfcf17841a8c48cac2ffbda4f (patch) | |
tree | 4d0dc17a620e1215c2c0c61682cc882d77ce0fb3 /src/sync.h | |
parent | 1ea76767d081054fe40c98f241b484d18133389e (diff) |
Put lock logging behind DEBUG_LOCKCONTENTION preprocessor directive
Github-Pull: #24770
Rebased-From: 39a34b6877945908759f6a2322f60852e521e2ee
Diffstat (limited to 'src/sync.h')
-rw-r--r-- | src/sync.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/sync.h b/src/sync.h index 85000a9151..af7595e6fa 100644 --- a/src/sync.h +++ b/src/sync.h @@ -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(); } |