diff options
author | laanwj <126646+laanwj@users.noreply.github.com> | 2022-04-13 22:32:45 +0200 |
---|---|---|
committer | laanwj <126646+laanwj@users.noreply.github.com> | 2022-04-13 22:59:33 +0200 |
commit | decde9bba6f9d3671bdf0af4fe6ff4bf28992d1d (patch) | |
tree | 8efd90e0e621dad6cab801f4beea5e97d9342a9f /src/sync.h | |
parent | 9b7eb584ade2ce73dbfcda080935172c3857b758 (diff) | |
parent | 1633f5ec8846408182cceb60dc88f022635f4002 (diff) |
Merge bitcoin/bitcoin#24355: util, refactor: Add UNIQUE_NAME helper macro
1633f5ec8846408182cceb60dc88f022635f4002 util, refactor: Add UNIQUE_NAME helper macro (Hennadii Stepanov)
Pull request description:
This PR replaces repetitive code with a helper macro.
ACKs for top commit:
laanwj:
Tested ACK 1633f5ec8846408182cceb60dc88f022635f4002
Tree-SHA512: 5f04e472c5f3184c0a9df75395377c6744bfb2cd8f95f8427c1c5e20daa7d6a9b29e45424b88391fc6326d365907a750ab50fda534b49d1df80dccf0e18467a4
Diffstat (limited to 'src/sync.h')
-rw-r--r-- | src/sync.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/sync.h b/src/sync.h index af7595e6fa..c69b58741b 100644 --- a/src/sync.h +++ b/src/sync.h @@ -223,12 +223,12 @@ public: friend class reverse_lock; }; -#define REVERSE_LOCK(g) typename std::decay<decltype(g)>::type::reverse_lock PASTE2(revlock, __COUNTER__)(g, #g, __FILE__, __LINE__) +#define REVERSE_LOCK(g) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, #g, __FILE__, __LINE__) template<typename MutexArg> using DebugLock = UniqueLock<typename std::remove_reference<typename std::remove_pointer<MutexArg>::type>::type>; -#define LOCK(cs) DebugLock<decltype(cs)> PASTE2(criticalblock, __COUNTER__)(cs, #cs, __FILE__, __LINE__) +#define LOCK(cs) DebugLock<decltype(cs)> UNIQUE_NAME(criticalblock)(cs, #cs, __FILE__, __LINE__) #define LOCK2(cs1, cs2) \ DebugLock<decltype(cs1)> criticalblock1(cs1, #cs1, __FILE__, __LINE__); \ DebugLock<decltype(cs2)> criticalblock2(cs2, #cs2, __FILE__, __LINE__); |