diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2022-02-16 14:51:11 +0200 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2022-02-16 14:59:20 +0200 |
commit | 1633f5ec8846408182cceb60dc88f022635f4002 (patch) | |
tree | f2d67f2417517780af0894e6311c5756f4be988d /src/sync.h | |
parent | 1e8aa02ec5cc2819c67ef40a7573c4b23a4c11cc (diff) |
util, refactor: Add UNIQUE_NAME helper macro
This change replaces repetitive code with a helper macro.
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 85000a9151..4311f67e88 100644 --- a/src/sync.h +++ b/src/sync.h @@ -218,12 +218,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__); |