summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2016-11-05 22:16:23 +0100
committerCarlos Garnacho <carlosg@gnome.org>2016-11-20 16:18:59 +0100
commit1f88dc694162f70fef552a4595b5a8a628a981fe (patch)
treed4ba655d9846bac3d55c0704184599a6518f1807
parent4c1efdaf2c662c26d3125a4dcd4621f515ac5a49 (diff)
downloadtracker-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.vala5
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 ();
}
}