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:
parent
92304b6d2c
commit
e3c3b847f6
@ -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) {
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user