[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/kdecore/io
From: Matthias Kretz <kretz () kde ! org>
Date: 2007-02-05 10:36:11
Message-ID: 1170671771.310134.28238.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 630402 by mkretz:
temporary solution to make kDebug threadsafe:
adds a mutex around all access to shared data
M +7 -0 kdebug.cpp
--- trunk/KDE/kdelibs/kdecore/io/kdebug.cpp #630401:630402
@@ -63,6 +63,7 @@
#endif
#include "kdebugdbusiface_p.h"
+#include <QMutex>
KDECORE_EXPORT bool kde_kdebug_enable_dbus_interface = false;
@@ -163,6 +164,7 @@
KConfig *config;
KDebugDBusIface *kDebugDBusIface;
QHash<unsigned int, QByteArray> cache;
+ QMutex mutex;
};
K_GLOBAL_STATIC(kDebugPrivate, kDebug_data)
@@ -204,6 +206,7 @@
short nOutput = 2;
if (!kDebug_data.isDestroyed()) {
+ kDebug_data->mutex.lock();
if (!kDebug_data->config && KGlobal::hasMainComponent()) {
kDebug_data->config = new KConfig(QLatin1String("kdebugrc"), false, false);
kDebug_data->config->setGroup(QLatin1String("0"));
@@ -227,6 +230,7 @@
}
nOutput = kDebug_data->config ? kDebug_data->config->readEntry(key, 2) : 2;
if (nOutput == 4 && nLevel != KDEBUG_FATAL) {
+ kDebug_data->mutex.unlock();
return;
}
}
@@ -303,6 +307,9 @@
|| !kDebug_data->config || kDebug_data->config->readEntry("AbortFatal", true))) {
abort();
}
+ if (!kDebug_data.isDestroyed()) {
+ kDebug_data->mutex.unlock();
+ }
}
kdbgstream &perror( kdbgstream &s)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic