13#ifndef DEBUGGINGAIDS_H
14#define DEBUGGINGAIDS_H
28#include "threadweaver_export.h"
34extern THREADWEAVER_EXPORT
bool Debug;
35extern THREADWEAVER_EXPORT
int DebugLevel;
36extern THREADWEAVER_EXPORT
QMutex GlobalMutex;
41extern inline void setDebugLevel(
bool TWDEBUG,
int level);
58inline void TWDEBUG(
int severity,
const char *cformat, ...)
60 __attribute__((format(printf, 2, 3)))
65inline 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); \
98inline void setDebugLevel(
bool debug,
int level)
106#define TWDEBUG(...) ThreadWeaver::threadweaver_debug(__VA_ARGS__)
107inline 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));
119inline 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));
135void THREADWEAVER_EXPORT mutexAssertUnlocked(
QMutex *mutex,
const char *where);
136void 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)
146inline 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
QStringView level(QStringView ifopt)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:38 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.