[tracker] libtracker-direct: Replace TrackerDBManager lock usage with private one



commit 1f88dc694162f70fef552a4595b5a8a628a981fe
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Nov 5 22:16:23 2016 +0100

    libtracker-direct: Replace TrackerDBManager lock usage with private one
    
    We need to lock here not because of the TrackerDBInterface, but because
    of other misc things needed at the time of constructing the SQL query
    (like TrackerOntologies, which constructs data on demand from the gvdb,
    this can't work across multiple threads).
    
    But we don't need to use the TrackerDBManager lock, it can be just
    a private one, and we remove another usage of this global lock.

 src/libtracker-direct/tracker-direct.vala |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-direct/tracker-direct.vala b/src/libtracker-direct/tracker-direct.vala
index 657fac8..ca37330 100644
--- a/src/libtracker-direct/tracker-direct.vala
+++ b/src/libtracker-direct/tracker-direct.vala
@@ -20,6 +20,7 @@
 public class Tracker.Direct.Connection : Tracker.Sparql.Connection {
        static int use_count;
        bool initialized;
+       private Mutex mutex = Mutex ();
 
        public Connection () throws Sparql.Error, IOError, DBusError {
                try {
@@ -80,11 +81,11 @@ public class Tracker.Direct.Connection : Tracker.Sparql.Connection {
                        throw new IOError.CANCELLED ("Operation was cancelled");
                }
 
-               DBManager.lock ();
+               mutex.lock ();
                try {
                        return query_unlocked (sparql);
                } finally {
-                       DBManager.unlock ();
+                       mutex.unlock ();
                }
        }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]