some improvements as suggested by mattr via review-board. boy, what a neat tool

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=768467
This commit is contained in:
Aaron J. Seigo 2008-01-30 06:17:13 +00:00
parent 099785fbdc
commit 55eb91140b
2 changed files with 9 additions and 5 deletions

View File

@ -44,8 +44,12 @@ class AbstractRunner::Private
speed(NormalSpeed),
tier(0)
{}
static QMutex serviceTypeTraderLock;
};
QMutex AbstractRunner::Private::serviceTypeTraderLock;
AbstractRunner::AbstractRunner(QObject* parent)
: QObject(parent),
d(new Private())
@ -151,11 +155,9 @@ void AbstractRunner::setPriority(Priority priority)
d->priority = priority;
}
QMutex serviceTypeTraderLock;
KService::List AbstractRunner::serviceQuery(const QString &serviceType, const QString &constraint) const
{
QMutexLocker lock(&serviceTypeTraderLock);
QMutexLocker lock(&Private::serviceTypeTraderLock);
return KServiceTypeTrader::self()->query(serviceType, constraint);
}

View File

@ -195,10 +195,12 @@ class PLASMA_EXPORT AbstractRunner : public QObject
void setPriority(Priority newPriority);
/**
* A thread safe (blocking) method to do queries of installed Services
* A blocking method to do queries of installed Services which can provide
* a measure of safety for runners running their own threads. This should
* be used instead of calling KServiceTypeTrader::query(..) directly.
*
* @arg serviceType a service type like "Plasma/Applet" or "KFilePlugin"
* @arg constraint a constraint to limie the the choices returned.
* @arg constraint a constraint to limit the the choices returned.
* @see KServiceTypeTrader::query(const QString&, const QString&)
*
* @return a list of services that satisfy the query.