refactor: consolidate PASTE macros

This commit is contained in:
James O'Beirne
2019-09-25 10:55:52 -04:00
parent 6e431296da
commit 0d86f4d3da
3 changed files with 13 additions and 3 deletions

View File

@@ -7,6 +7,7 @@
#define BITCOIN_SYNC_H
#include <threadsafety.h>
#include <util/macros.h>
#include <condition_variable>
#include <thread>
@@ -176,9 +177,6 @@ public:
template<typename MutexArg>
using DebugLock = UniqueLock<typename std::remove_reference<typename std::remove_pointer<MutexArg>::type>::type>;
#define PASTE(x, y) x ## y
#define PASTE2(x, y) PASTE(x, y)
#define LOCK(cs) DebugLock<decltype(cs)> PASTE2(criticalblock, __COUNTER__)(cs, #cs, __FILE__, __LINE__)
#define LOCK2(cs1, cs2) \
DebugLock<decltype(cs1)> criticalblock1(cs1, #cs1, __FILE__, __LINE__); \