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)
|
AbstractRunner::AbstractRunner(QObject* parent, const QString& serviceId)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
@ -186,10 +186,15 @@ void AbstractRunner::setPriority(Priority priority)
|
|||||||
|
|
||||||
KService::List AbstractRunner::serviceQuery(const QString &serviceType, const QString &constraint) const
|
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);
|
return KServiceTypeTrader::self()->query(serviceType, constraint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QMutex& AbstractRunner::bigLock() const
|
||||||
|
{
|
||||||
|
return Private::bigLock;
|
||||||
|
}
|
||||||
|
|
||||||
void AbstractRunner::exec(Plasma::SearchMatch *action)
|
void AbstractRunner::exec(Plasma::SearchMatch *action)
|
||||||
{
|
{
|
||||||
if (d->script) {
|
if (d->script) {
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#define RUNNER_H
|
#define RUNNER_H
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
|
#include <QtCore/QMutex>
|
||||||
#include <QtCore/QStringList>
|
#include <QtCore/QStringList>
|
||||||
|
|
||||||
#include <KDE/KConfigGroup>
|
#include <KDE/KConfigGroup>
|
||||||
@ -221,6 +222,8 @@ class PLASMA_EXPORT AbstractRunner : public QObject
|
|||||||
KService::List serviceQuery(const QString &serviceType,
|
KService::List serviceQuery(const QString &serviceType,
|
||||||
const QString &constraint = QString()) const;
|
const QString &constraint = QString()) const;
|
||||||
|
|
||||||
|
const QMutex& bigLock() const;
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user