diff --git a/abstractrunner.cpp b/abstractrunner.cpp index bb1ab7a5c..207f8bc9c 100644 --- a/abstractrunner.cpp +++ b/abstractrunner.cpp @@ -258,7 +258,7 @@ KService::List AbstractRunner::serviceQuery(const QString &serviceType, const QS return KServiceTypeTrader::self()->query(serviceType, constraint); } -QMutex* AbstractRunner::bigLock() const +QMutex* AbstractRunner::bigLock() { return s_bigLock; } diff --git a/abstractrunner.h b/abstractrunner.h index 0f1d3e494..b50895975 100644 --- a/abstractrunner.h +++ b/abstractrunner.h @@ -219,6 +219,20 @@ class PLASMA_EXPORT AbstractRunner : public QObject */ virtual void reloadConfiguration(); + /** + * Access to a shared lock that all runners (and code that manages/interacts with them) + * can share to protect access to non-thread-safe shared code or data. + * Access of KSycoca records, for instance, is one place this lock should be used. + * + * Common usage: + * + * { + * QMutexLocker lock(bigLock()); + * .. do something that isn't thread safe .. + * } + */ + static QMutex *bigLock(); + protected: friend class RunnerManager; friend class RunnerManagerPrivate; @@ -269,8 +283,6 @@ class PLASMA_EXPORT AbstractRunner : public QObject KService::List serviceQuery(const QString &serviceType, const QString &constraint = QString()) const; - QMutex *bigLock() const; - /** * A given match can have more than action that can be performed on it. * For example, a song match returned by a music player runner can be queued,