ThreadWeaver
13 #ifndef DEBUGGINGAIDS_H
14 #define DEBUGGINGAIDS_H
28 #include "threadweaver_export.h"
32 namespace ThreadWeaver
34 extern THREADWEAVER_EXPORT
bool Debug;
35 extern THREADWEAVER_EXPORT
int DebugLevel;
36 extern THREADWEAVER_EXPORT
QMutex GlobalMutex;
41 extern inline void setDebugLevel(
bool TWDEBUG,
int level);
58 inline void TWDEBUG(
int severity,
const char *cformat, ...)
60 __attribute__((format(printf, 2, 3)))
65 inline void TWDEBUG(
bool condition,
int severity,
const char *cformat, ...)
67 __attribute__((format(printf, 3, 4)))
80 QMutexLocker l(&ThreadWeaver::GlobalMutex); \
93 QMutexLocker l(&ThreadWeaver::GlobalMutex); \
98 inline void setDebugLevel(
bool debug,
int level)
106 #define TWDEBUG(...) ThreadWeaver::threadweaver_debug(__VA_ARGS__)
107 inline void threadweaver_debug(
int severity,
const char *cformat, ...)
109 if (Debug ==
true && (severity <= DebugLevel || severity == 0)) {
113 va_start(ap, cformat);
114 PROTECT(vprintf(cformat, ap));
119 inline void threadweaver_debug(
bool condition,
int severity,
const char *cformat, ...)
121 if (condition && Debug ==
true && (severity <= DebugLevel || severity == 0)) {
125 va_start(ap, cformat);
126 PROTECT(vprintf(cformat, ap));
135 void THREADWEAVER_EXPORT mutexAssertUnlocked(
QMutex *mutex,
const char *where);
136 void THREADWEAVER_EXPORT mutexAssertLocked(
QMutex *mutex,
const char *where);
139 #define MUTEX_ASSERT_UNLOCKED(x) mutexAssertUnlocked(x, Q_FUNC_INFO)
140 #define MUTEX_ASSERT_LOCKED(x) mutexAssertLocked(x, Q_FUNC_INFO)
142 #define MUTEX_ASSERT_UNLOCKED(x)
143 #define MUTEX_ASSERT_LOCKED(x)
146 inline bool invariant()
151 #define INVARIANT Q_ASSERT_X(invariant(), __FILE__, "class invariant failed");
156 Q_ASSERT_X(x, Q_FUNC_INFO, "unfulfilled requirement " #x);
160 Q_ASSERT_X(x, Q_FUNC_INFO, "broken guarantee " #x);
166 #define DEBUGONLY(x) x
171 #endif // DEBUGGINGAIDS_H
QStringView level(QStringView ifopt)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Sep 21 2023 04:10:21 by
doxygen 1.8.17 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.