aboutsummaryrefslogtreecommitdiff
path: root/src/sync.h
diff options
context:
space:
mode:
authorPavel Janík <Pavel@Janik.cz>2016-08-06 10:54:29 +0200
committerPavel Janík <Pavel@Janik.cz>2016-08-06 10:54:29 +0200
commit33d15a3a76d073986337adcd62646d93e7ba223f (patch)
tree3c3399c381ff9ddb45adfad2bfb8d634853d05a5 /src/sync.h
parent6e6ab2c3238264b34c0c83ebf703502f5ec72848 (diff)
Do not shadow LOCK's criticalblock variable for LOCK inside LOCK
Diffstat (limited to 'src/sync.h')
-rw-r--r--src/sync.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/sync.h b/src/sync.h
index 0c58fb6b4e..7733910749 100644
--- a/src/sync.h
+++ b/src/sync.h
@@ -171,7 +171,10 @@ public:
typedef CMutexLock<CCriticalSection> CCriticalBlock;
-#define LOCK(cs) CCriticalBlock criticalblock(cs, #cs, __FILE__, __LINE__)
+#define PASTE(x, y) x ## y
+#define PASTE2(x, y) PASTE(x, y)
+
+#define LOCK(cs) CCriticalBlock PASTE2(criticalblock, __COUNTER__)(cs, #cs, __FILE__, __LINE__)
#define LOCK2(cs1, cs2) CCriticalBlock criticalblock1(cs1, #cs1, __FILE__, __LINE__), criticalblock2(cs2, #cs2, __FILE__, __LINE__)
#define TRY_LOCK(cs, name) CCriticalBlock name(cs, #cs, __FILE__, __LINE__, true)