Skip to content

Commit

Permalink
Do not shadow LOCK's criticalblock variable for LOCK inside LOCK
Browse files Browse the repository at this point in the history
  • Loading branch information
paveljanik committed Aug 6, 2016
1 parent 6e6ab2c commit 33d15a3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ class SCOPED_LOCKABLE CMutexLock

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)

Expand Down

0 comments on commit 33d15a3

Please sign in to comment.