provide a bigLock() for runners to use whenever accessing common but non-reentrant api (e.g. most everything in kdelibs ;)

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=770952
This commit is contained in:
Aaron J. Seigo 2008-02-04 20:28:09 +00:00
parent 92304b6d2c
commit e3c3b847f6
2 changed files with 11 additions and 3 deletions

View File

@ -68,10 +68,10 @@ class AbstractRunner::Private
}
}
static QMutex serviceTypeTraderLock;
static QMutex bigLock;
};
QMutex AbstractRunner::Private::serviceTypeTraderLock;
QMutex AbstractRunner::Private::bigLock;
AbstractRunner::AbstractRunner(QObject* parent, const QString& serviceId)
: QObject(parent),
@ -186,10 +186,15 @@ void AbstractRunner::setPriority(Priority priority)
KService::List AbstractRunner::serviceQuery(const QString &serviceType, const QString &constraint) const
{
QMutexLocker lock(&Private::serviceTypeTraderLock);
QMutexLocker lock(&Private::bigLock);
return KServiceTypeTrader::self()->query(serviceType, constraint);
}
const QMutex& AbstractRunner::bigLock() const
{
return Private::bigLock;
}
void AbstractRunner::exec(Plasma::SearchMatch *action)
{
if (d->script) {

View File

@ -21,6 +21,7 @@
#define RUNNER_H
#include <QtCore/QObject>
#include <QtCore/QMutex>
#include <QtCore/QStringList>
#include <KDE/KConfigGroup>
@ -221,6 +222,8 @@ class PLASMA_EXPORT AbstractRunner : public QObject
KService::List serviceQuery(const QString &serviceType,
const QString &constraint = QString()) const;
const QMutex& bigLock() const;
protected slots:
void init();