[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/4.3/kdebase/workspace/plasma/runners/services
From:       Jacopo De Simoi <wilderkde () gmail ! com>
Date:       2009-09-10 14:49:43
Message-ID: 1252594183.076845.22978.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1022012 by jacopods:

use the bigLock more efficiently - thanks Pino


 M  +6 -2      servicerunner.cpp  


--- branches/KDE/4.3/kdebase/workspace/plasma/runners/services/servicerunner.cpp \
#1022011:1022012 @@ -50,14 +50,16 @@
         return;
     }
 
-    // KServiceTypeTrader::query() is not thread-safe in 4.3, welcome back bigLock
-    QMutexLocker lock(bigLock());
 
     // Search for applications which are executable and case-insensitively match the \
                search term
     // See http://techbase.kde.org/Development/Tutorials/Services/Traders#The_KTrader_Query_Language
  // if the following is unclear to you.
     QString query = QString("exist Exec and ('%1' =~ Name)").arg(term);
+
+    // KServiceTypeTrader::query() is not thread-safe in 4.3, welcome back bigLock
+    bigLock()->lock();
     KService::List services = KServiceTypeTrader::self()->query("Application", \
query); +    bigLock()->unlock();
 
     QList<Plasma::QueryMatch> matches;
 
@@ -88,8 +90,10 @@
     // Note that before asking for the content of e.g. Keywords and GenericName we \
                need to ask if
     // they exist to prevent a tree evaluation error if they are not defined.
     query = QString("exist Exec and ( (exist Keywords and '%1' ~subin Keywords) or \
(exist GenericName and '%1' ~~ GenericName) or (exist Name and '%1' ~~ Name) \
)").arg(term); +    bigLock()->lock();
     services = KServiceTypeTrader::self()->query("Application", query);
     services += KServiceTypeTrader::self()->query("KCModule", query);
+    bigLock()->unlock();
 
     //kDebug() << "got " << services.count() << " services from " << query;
     foreach (const KService::Ptr &service, services) {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic