ThreadWeaver
Go to the documentation of this file.
31 #ifndef DEBUGGINGAIDS_H
32 #define DEBUGGINGAIDS_H
34 #include <QtCore/QtGlobal>
47 #include <QtCore/QMutex>
48 #include <QtCore/QString>
51 namespace ThreadWeaver {
53 extern THREADWEAVER_EXPORT
bool Debug;
77 inline void debug(
int severity,
const char * cformat, ...)
79 __attribute__ ( (format (printf, 2, 3 ) ) )
84 inline void debug(
bool condition,
int severity,
const char * cformat, ...)
86 __attribute__ ( (format (printf, 3, 4 ) ) )
96 #define PROTECT(x) do { QMutexLocker l(&ThreadWeaver::GlobalMutex); (x); } while (0)
103 #define P_ASSERT(x) do { QMutexLocker l(&ThreadWeaver::GlobalMutex); Q_ASSERT(x); } while (0)
112 inline void debug(
int severity,
const char * cformat, ...)
119 va_start( ap, cformat );
120 PROTECT (vprintf (cformat, ap));
125 inline void debug(
bool condition,
int severity,
const char *cformat, ...)
127 if (condition &&
Debug ==
true && ( severity<=
DebugLevel || severity == 0) )
132 va_start( ap, cformat );
133 PROTECT (vprintf (cformat, ap));
138 inline void debug(
int,
const char *, ...) {}
139 inline void debug(
bool,
int,
const char *, ...) {}
144 #define INVARIANT Q_ASSERT_X (invariant(), __FILE__, "class invariant failed" );
148 Q_ASSERT_X (x, Q_FUNC_INFO, "unfulfilled requirement " #x );
152 Q_ASSERT_X (x, Q_FUNC_INFO, "broken guarantee " #x );
158 #define DEBUGONLY(x) x
163 #endif // DEBUGGINGAIDS_H
QMutex GlobalMutex
A global mutex for the ThreadWeaver objects.
#define PROTECT(x)
PROTECT executes x with GlobalMutex locked.
void setDebugLevel(bool debug, int level)
Set the debug log level.
void debug(int severity, const char *cformat,...)
This method prints a text message on the screen, if debugging is enabled.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:23:33 by
doxygen 1.8.7 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.