You don't need QAtomic if you're not thread-safe

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=705296
This commit is contained in:
Thiago Macieira 2007-08-27 17:27:27 +00:00
parent 8bc26d704f
commit 0ad0b8c21f
2 changed files with 6 additions and 7 deletions

View File

@ -18,7 +18,6 @@
#include "datacontainer.h" #include "datacontainer.h"
#include <QAtomic>
#include <QVariant> #include <QVariant>
#include <KDebug> #include <KDebug>
@ -34,7 +33,7 @@ class DataContainer::Private
{} {}
DataEngine::Data data; DataEngine::Data data;
QAtomic connectCount; int connectCount;
bool dirty : 1; bool dirty : 1;
}; };
@ -91,7 +90,7 @@ void DataContainer::checkForUpdate()
void DataContainer::connectNotify(const char *signal) void DataContainer::connectNotify(const char *signal)
{ {
if (QLatin1String(signal) == QMetaObject::normalizedSignature(SIGNAL(updated(QString, Plasma::DataEngine::Data))).constData()) { if (QLatin1String(signal) == QMetaObject::normalizedSignature(SIGNAL(updated(QString, Plasma::DataEngine::Data))).constData()) {
d->connectCount.ref(); ++d->connectCount;
} }
} }
@ -99,7 +98,7 @@ void DataContainer::disconnectNotify(const char *signal)
{ {
if (QLatin1String(signal) == QMetaObject::normalizedSignature(SIGNAL(updated(QString, Plasma::DataEngine::Data))).constData()) { if (QLatin1String(signal) == QMetaObject::normalizedSignature(SIGNAL(updated(QString, Plasma::DataEngine::Data))).constData()) {
if (d->connectCount > 0) { if (d->connectCount > 0) {
d->connectCount.deref(); --d->connectCount;
} }
if (d->connectCount < 1) { if (d->connectCount < 1) {

View File

@ -114,7 +114,7 @@ class DataEngine::Private
updateTimer->start(0); updateTimer->start(0);
} }
QAtomic ref; int ref;
DataEngine::SourceDict sources; DataEngine::SourceDict sources;
QQueue<DataContainer*> sourceQueue; QQueue<DataContainer*> sourceQueue;
DataEngine* engine; DataEngine* engine;
@ -308,12 +308,12 @@ void DataEngine::clearSources()
void DataEngine::ref() void DataEngine::ref()
{ {
d->ref.ref(); --d->ref;
} }
void DataEngine::deref() void DataEngine::deref()
{ {
d->ref.deref(); ++d->ref;
} }
bool DataEngine::isUsed() const bool DataEngine::isUsed() const