Convenient macro for thread checker to use it once in-place.

This commit is contained in:
Alex Zolotarev 2016-03-09 13:01:52 +03:00 committed by Sergey Yershov
parent 5d8f3914f6
commit 0faa81ef57

View file

@ -26,7 +26,12 @@ private:
#if defined(DEBUG)
#define DECLARE_THREAD_CHECKER(threadCheckerName) ThreadChecker threadCheckerName
#define ASSERT_THREAD_CHECKER(threadCheckerName, msg) ASSERT(threadCheckerName.CalledOnOriginalThread(), msg)
#define DECLARE_AND_ASSERT_THREAD_CHECKER(msg) { \
static const ThreadChecker threadChecker; \
ASSERT(threadChecker.CalledOnOriginalThread(), (msg)); \
}
#else
#define DECLARE_THREAD_CHECKER(threadCheckerName)
#define ASSERT_THREAD_CHECKER(threadCheckerName, msg)
#define DECLARE_AND_ASSERT_THREAD_CHECKER(msg)
#endif