diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2016-11-05 22:16:23 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2016-11-20 16:18:59 +0100 |
commit | 1f88dc694162f70fef552a4595b5a8a628a981fe (patch) | |
tree | d4ba655d9846bac3d55c0704184599a6518f1807 | |
parent | 4c1efdaf2c662c26d3125a4dcd4621f515ac5a49 (diff) | |
download | tracker-1f88dc694162f70fef552a4595b5a8a628a981fe.tar.gz |
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.
-rw-r--r-- | 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 657fac888..ca373304e 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 (); } } |