Commit 0ec98786 authored by Jürg Billeter's avatar Jürg Billeter

libtracker-sparql: Use static linking instead of plugins

Plugin loading in threads may be problematic in certain environments.
As we do not currently support external plugins anyway, this changes
libtracker-bus and libtracker-direct to be part of libtracker-sparql.
This will also slightly improve initialization performance.

Fixes NB#241659.
parent 8c9074f1
......@@ -2012,8 +2012,9 @@ AC_CONFIG_FILES([
src/libtracker-common/Makefile
src/libtracker-sparql/Makefile
src/libtracker-bus/Makefile
src/libtracker-direct/Makefile
src/libtracker-data/Makefile
src/libtracker-direct/Makefile
src/libtracker-sparql-backend/Makefile
src/libtracker-fts/Makefile
src/libtracker-extract/Makefile
src/libtracker-miner/Makefile
......
......@@ -46,7 +46,7 @@ AM_CPPFLAGS = \
GTKDOC_LIBS = \
$(top_builddir)/src/libtracker-miner/libtracker-miner-@TRACKER_API_VERSION@.la \
$(top_builddir)/src/libtracker-sparql/libtracker-sparql-@TRACKER_API_VERSION@.la \
$(top_builddir)/src/libtracker-sparql-backend/libtracker-sparql-@TRACKER_API_VERSION@.la \
$(top_builddir)/src/libtracker-common/libtracker-common.la \
$(LIBTRACKER_MINER_LIBS)
......
......@@ -32,7 +32,7 @@ AM_CPPFLAGS = \
$(LIBTRACKER_SPARQL_CFLAGS)
GTKDOC_LIBS = \
$(top_builddir)/src/libtracker-sparql/libtracker-sparql-@TRACKER_API_VERSION@.la \
$(top_builddir)/src/libtracker-sparql-backend/libtracker-sparql-@TRACKER_API_VERSION@.la \
$(top_builddir)/src/libtracker-common/libtracker-common.la \
$(LIBTRACKER_SPARQL_LIBS)
......
......@@ -115,17 +115,6 @@ $ pkg-config --libs tracker-sparql-0.10
"bus" value means a D-Bus / IPC approach will be forced.
</para>
</listitem>
<listitem>
<emphasis>TRACKER_SPARQL_MODULE_PATH</emphasis>
<para>
As explained in the last paragraph, the backends are
dynamically loaded at run time. The location for these
backends is usually in a set
place: <emphasis>$prefix/lib/tracker-$version/sparql-modules</emphasis>.
This environment variable is mostly useful for the unit
tests and general debugging to override this location.
</para>
</listitem>
<listitem>
<emphasis>TRACKER_SPARQL_CACHE_SIZE</emphasis>
<para>
......
......@@ -12,6 +12,7 @@ AM_CPPFLAGS = \
LDADD = \
$(top_builddir)/src/libtracker-common/libtracker-common.la \
$(top_builddir)/src/libtracker-data/libtracker-data.la \
$(top_builddir)/src/libtracker-sparql-backend/libtracker-sparql-@TRACKER_API_VERSION@.la \
$(LIBTRACKER_DATA_LIBS)
ontology_graph_SOURCES = \
......
......@@ -15,7 +15,7 @@ libextract_mockup_la_SOURCES = tracker-extract-mockup.c
libextract_mockup_la_LDFLAGS = $(module_flags)
libextract_mockup_la_LIBADD = \
$(top_builddir)/src/libtracker-extract/libtracker-extract-@TRACKER_API_VERSION@.la \
$(top_builddir)/src/libtracker-sparql/libtracker-sparql-@TRACKER_API_VERSION@.la \
$(top_builddir)/src/libtracker-sparql-backend/libtracker-sparql-@TRACKER_API_VERSION@.la \
$(BUILD_LIBS) \
$(LIBTRACKER_EXTRACT_LIBS)
......
......@@ -11,7 +11,7 @@ AM_CPPFLAGS = \
LDADD = \
$(top_builddir)/src/libtracker-miner/libtracker-miner-@TRACKER_API_VERSION@.la \
$(top_builddir)/src/libtracker-sparql/libtracker-sparql-@TRACKER_API_VERSION@.la \
$(top_builddir)/src/libtracker-sparql-backend/libtracker-sparql-@TRACKER_API_VERSION@.la \
$(top_builddir)/src/libtracker-common/libtracker-common.la \
$(BUILD_LIBS) \
$(LIBTRACKER_MINER_LIBS)
......
......@@ -6,7 +6,7 @@ AM_CPPFLAGS = $(BUILD_CFLAGS) \
-I$(top_srcdir)/src \
$(LIBTRACKER_SPARQL_CFLAGS)
LDADD = $(top_builddir)/src/libtracker-sparql/libtracker-sparql-$(TRACKER_API_VERSION).la \
LDADD = $(top_builddir)/src/libtracker-sparql-backend/libtracker-sparql-$(TRACKER_API_VERSION).la \
$(BUILD_LIBS) \
$(LIBTRACKER_SPARQL_LIBS)
......
......@@ -17,6 +17,7 @@ SUBDIRS = \
libtracker-bus \
libtracker-data \
libtracker-direct \
libtracker-sparql-backend \
libtracker-extract \
libtracker-miner \
miners \
......
include $(top_srcdir)/Makefile.decl
modulesdir = $(libdir)/tracker-$(TRACKER_API_VERSION)/sparql-modules
modules_LTLIBRARIES = libtracker-bus.la
noinst_LTLIBRARIES = libtracker-bus.la
AM_VALAFLAGS = \
--includedir=libtracker-bus \
......@@ -26,14 +24,10 @@ libtracker_bus_la_SOURCES = \
tracker-bus-fd-cursor.vala
libtracker_bus_la_LIBADD = \
$(top_builddir)/src/libtracker-sparql/libtracker-sparql-$(TRACKER_API_VERSION).la \
$(top_builddir)/src/libtracker-common/libtracker-common.la \
$(BUILD_LIBS) \
$(LIBTRACKER_BUS_LIBS)
libtracker_bus_la_LDFLAGS = \
-module -avoid-version -no-undefined
noinst_HEADERS = \
tracker-bus.h
......
......@@ -349,8 +349,3 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
types);
}
}
public Tracker.Sparql.Connection? module_init () throws GLib.Error {
Tracker.Sparql.Connection plugin = new Tracker.Bus.Connection ();
return plugin;
}
......@@ -47,7 +47,6 @@ libtracker_data_la_SOURCES = \
libtracker_data_la_LIBADD = \
$(top_builddir)/src/gvdb/libgvdb.la \
$(top_builddir)/src/libtracker-common/libtracker-common.la \
$(top_builddir)/src/libtracker-sparql/libtracker-sparql-@TRACKER_API_VERSION@.la \
$(BUILD_LIBS) \
$(LIBTRACKER_DATA_LIBS)
......
include $(top_srcdir)/Makefile.decl
modulesdir = $(libdir)/tracker-$(TRACKER_API_VERSION)/sparql-modules
modules_LTLIBRARIES = libtracker-direct.la
noinst_LTLIBRARIES = libtracker-direct.la
AM_VALAFLAGS = \
--includedir=libtracker-direct \
......@@ -29,9 +27,6 @@ libtracker_direct_la_LIBADD = \
$(BUILD_LIBS) \
$(LIBTRACKER_DIRECT_LIBS)
libtracker_direct_la_LDFLAGS = \
-module -avoid-version -no-undefined
noinst_HEADERS = \
tracker-direct.h
......
......@@ -120,8 +120,3 @@ public class Tracker.Direct.Connection : Tracker.Sparql.Connection {
}
}
}
public Tracker.Sparql.Connection? module_init () throws GLib.Error {
Tracker.Sparql.Connection plugin = new Tracker.Direct.Connection ();
return plugin;
}
......@@ -43,7 +43,7 @@ libtracker_extract_@TRACKER_API_VERSION@_la_LDFLAGS = \
-export-symbols-regex '^tracker_.*'
libtracker_extract_@TRACKER_API_VERSION@_la_LIBADD = \
$(top_builddir)/src/libtracker-sparql/libtracker-sparql-@TRACKER_API_VERSION@.la \
$(top_builddir)/src/libtracker-sparql-backend/libtracker-sparql-@TRACKER_API_VERSION@.la \
$(top_builddir)/src/libtracker-common/libtracker-common.la \
$(BUILD_LIBS) \
$(LIBTRACKER_EXTRACT_LIBS)
......@@ -66,7 +66,7 @@ libtracker_miner_@TRACKER_API_VERSION@_la_LDFLAGS = \
libtracker_miner_@TRACKER_API_VERSION@_la_LIBADD = \
$(top_builddir)/src/libtracker-common/libtracker-common.la \
$(top_builddir)/src/libtracker-sparql/libtracker-sparql-@TRACKER_API_VERSION@.la \
$(top_builddir)/src/libtracker-sparql-backend/libtracker-sparql-@TRACKER_API_VERSION@.la \
-lm \
$(BUILD_LIBS) \
$(LIBTRACKER_MINER_LIBS)
......
include $(top_srcdir)/Makefile.decl
lib_LTLIBRARIES = libtracker-sparql-@TRACKER_API_VERSION@.la
AM_VALAFLAGS = \
--pkg gio-2.0 \
$(BUILD_VALAFLAGS) \
$(top_srcdir)/src/libtracker-sparql/tracker-sparql-$(TRACKER_API_VERSION).vapi \
$(top_srcdir)/src/libtracker-bus/tracker-bus.vapi \
$(top_srcdir)/src/libtracker-direct/tracker-direct.vapi
AM_CPPFLAGS = \
$(BUILD_CFLAGS) \
-I$(top_srcdir)/src \
-I$(top_builddir)/src \
$(LIBTRACKER_SPARQL_CFLAGS)
libtracker_sparql_@TRACKER_API_VERSION@_la_SOURCES = \
tracker-backend.vala
libtracker_sparql_@TRACKER_API_VERSION@_la_LIBADD = \
$(top_builddir)/src/libtracker-sparql/libtracker-sparql.la \
$(top_builddir)/src/libtracker-bus/libtracker-bus.la \
$(top_builddir)/src/libtracker-direct/libtracker-direct.la \
$(BUILD_LIBS) \
$(LIBTRACKER_SPARQL_LIBS)
libtracker_sparql_@TRACKER_API_VERSION@_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
-export-symbols-regex '^tracker_sparql_(connection|cursor|builder|escape|error|value|get)_.*'
......@@ -23,8 +23,6 @@ interface Tracker.Backend.Status : DBusProxy {
}
class Tracker.Sparql.Backend : Connection {
bool direct_only;
Tracker.Sparql.Connection direct = null;
Tracker.Sparql.Connection bus = null;
enum Backend {
......@@ -33,19 +31,11 @@ class Tracker.Sparql.Backend : Connection {
BUS
}
[CCode (has_target = false)]
private delegate Tracker.Sparql.Connection? ModuleInitFunc () throws GLib.Error;
public Backend (bool direct_only = false) throws Sparql.Error
requires (Module.supported ()) {
this.direct_only = direct_only;
}
public override void init () throws Sparql.Error, IOError, DBusError, SpawnError {
Tracker.Backend.Status status = Bus.get_proxy_sync (BusType.SESSION,
TRACKER_DBUS_SERVICE,
TRACKER_DBUS_OBJECT_STATUS,
DBusProxyFlags.DO_NOT_LOAD_PROPERTIES | DBusProxyFlags.DO_NOT_CONNECT_SIGNALS);
Tracker.Backend.Status status = GLib.Bus.get_proxy_sync (BusType.SESSION,
TRACKER_DBUS_SERVICE,
TRACKER_DBUS_OBJECT_STATUS,
DBusProxyFlags.DO_NOT_LOAD_PROPERTIES | DBusProxyFlags.DO_NOT_CONNECT_SIGNALS);
status.set_default_timeout (int.MAX);
// Makes sure the sevice is available
......@@ -146,18 +136,6 @@ class Tracker.Sparql.Backend : Connection {
// Plugin loading functions
private bool load_plugins (bool direct_only) throws GLib.Error {
string env_path = Environment.get_variable ("TRACKER_SPARQL_MODULE_PATH");
string path;
if (env_path != null && env_path.length > 0) {
path = env_path;
} else {
path = Config.SPARQL_MODULES_DIR;
}
File dir = File.new_for_path (path);
string dir_path = dir.get_path ();
string env_backend = Environment.get_variable ("TRACKER_SPARQL_BACKEND");
Backend backend = Backend.AUTO;
......@@ -186,80 +164,193 @@ class Tracker.Sparql.Backend : Connection {
debug ("Backend set in environment contradicts requested connection type, using environment to override");
}
debug ("Searching for modules in folder '%s' ..", dir_path);
Tracker.Sparql.Connection connection;
switch (backend) {
case backend.AUTO:
string direct_path = Module.build_path (dir_path, "tracker-direct");
direct = load_plugins_from_path (direct_path, false /* required */);
try {
direct = new Tracker.Direct.Connection ();
} catch (Error e) {
debug ("Unable to initialize direct backend");
}
string bus_path = Module.build_path (dir_path, "tracker-bus");
bus = load_plugins_from_path (bus_path, true /* required */);
bus = new Tracker.Bus.Connection ();
connection = bus;
break;
case backend.DIRECT:
string direct_path = Module.build_path (dir_path, "tracker-direct");
connection = direct = load_plugins_from_path (direct_path, true /* required */);
connection = direct = new Tracker.Direct.Connection ();
break;
case backend.BUS:
string bus_path = Module.build_path (dir_path, "tracker-bus");
connection = bus = load_plugins_from_path (bus_path, true /* required */);
connection = bus = new Tracker.Bus.Connection ();
break;
default:
assert_not_reached ();
}
debug ("Finished searching for modules");
return connection != null;
}
private Tracker.Sparql.Connection? load_plugins_from_path (string path, bool required) throws GLib.Error {
try {
// lazy resolving reduces initialization time
Module module = Module.open (path, ModuleFlags.BIND_LOCAL | ModuleFlags.BIND_LAZY);
if (module == null) {
throw new IOError.FAILED ("Failed to load module from path '%s': %s",
path,
Module.error ());
}
static bool direct_only;
static weak Connection? singleton;
static bool log_initialized;
static StaticMutex door;
void *function;
public static new Connection get_internal (bool is_direct_only = false, Cancellable? cancellable = null) throws Sparql.Error, IOError, DBusError, SpawnError {
door.lock ();
if (!module.symbol ("module_init", out function)) {
throw new IOError.FAILED ("Failed to find entry point function '%s' in '%s': %s",
"module_init",
path,
Module.error ());
}
// assign to owned variable to ensure it doesn't get freed between unlock and return
var result = singleton;
if (result != null) {
assert (direct_only == is_direct_only);
door.unlock ();
return result;
}
ModuleInitFunc module_init = (ModuleInitFunc) function;
assert (module_init != null);
log_init ();
// We don't want our modules to ever unload
module.make_resident ();
direct_only = is_direct_only;
// Call module init function
Tracker.Sparql.Connection c = module_init ();
result = new Tracker.Sparql.Backend ();
result.init ();
debug ("Loaded module source: '%s'", module.name ());
if (cancellable != null && cancellable.is_cancelled ()) {
door.unlock ();
throw new IOError.CANCELLED ("Operation was cancelled");
}
return c;
} catch (GLib.Error e) {
if (required) {
// plugin required => error is fatal
throw e;
} else {
return null;
singleton = result;
result.add_weak_pointer ((void**) (&singleton));
door.unlock ();
return singleton;
}
public async static new Connection get_internal_async (bool is_direct_only = false, Cancellable? cancellable = null) throws Sparql.Error, IOError, DBusError, SpawnError {
// fast path: avoid extra thread if connection is already available
if (door.trylock ()) {
// assign to owned variable to ensure it doesn't get freed between unlock and return
var result = singleton;
door.unlock ();
if (result != null) {
assert (direct_only == is_direct_only);
return result;
}
}
// run in a separate thread
Sparql.Error sparql_error = null;
IOError io_error = null;
DBusError dbus_error = null;
SpawnError spawn_error = null;
Connection result = null;
var context = MainContext.get_thread_default ();
g_io_scheduler_push_job (job => {
try {
result = get_internal (is_direct_only, cancellable);
} catch (IOError e_io) {
io_error = e_io;
} catch (Sparql.Error e_spql) {
sparql_error = e_spql;
} catch (DBusError e_dbus) {
dbus_error = e_dbus;
} catch (SpawnError e_spawn) {
spawn_error = e_spawn;
}
var source = new IdleSource ();
source.set_callback (() => {
get_internal_async.callback ();
return false;
});
source.attach (context);
return false;
});
yield;
if (sparql_error != null) {
throw sparql_error;
} else if (io_error != null) {
throw io_error;
} else if (dbus_error != null) {
throw dbus_error;
} else if (spawn_error != null) {
throw spawn_error;
} else {
return result;
}
}
private static void log_init () {
if (log_initialized) {
return;
}
log_initialized = true;
// Avoid debug messages
int verbosity = 0;
string env_verbosity = Environment.get_variable ("TRACKER_VERBOSITY");
if (env_verbosity != null)
verbosity = env_verbosity.to_int ();
LogLevelFlags remove_levels = 0;
switch (verbosity) {
// Log level 3: EVERYTHING
case 3:
break;
// Log level 2: CRITICAL/ERROR/WARNING/INFO/MESSAGE only
case 2:
remove_levels = LogLevelFlags.LEVEL_DEBUG;
break;
// Log level 1: CRITICAL/ERROR/WARNING/INFO only
case 1:
remove_levels = LogLevelFlags.LEVEL_DEBUG |
LogLevelFlags.LEVEL_MESSAGE;
break;
// Log level 0: CRITICAL/ERROR/WARNING only (default)
default:
case 0:
remove_levels = LogLevelFlags.LEVEL_DEBUG |
LogLevelFlags.LEVEL_MESSAGE |
LogLevelFlags.LEVEL_INFO;
break;
}
if (remove_levels != 0) {
GLib.Log.set_handler ("Tracker", remove_levels, remove_log_handler);
}
}
private static void remove_log_handler (string? log_domain, LogLevelFlags log_level, string message) {
/* do nothing */
}
}
public async static Tracker.Sparql.Connection tracker_sparql_connection_get_async (Cancellable? cancellable = null) throws Tracker.Sparql.Error, IOError, DBusError, SpawnError {
return yield Tracker.Sparql.Backend.get_internal_async (false, cancellable);
}
public static Tracker.Sparql.Connection tracker_sparql_connection_get (Cancellable? cancellable = null) throws Tracker.Sparql.Error, IOError, DBusError, SpawnError {
return Tracker.Sparql.Backend.get_internal (false, cancellable);
}
public async static Tracker.Sparql.Connection tracker_sparql_connection_get_direct_async (Cancellable? cancellable = null) throws Tracker.Sparql.Error, IOError, DBusError, SpawnError {
return yield Tracker.Sparql.Backend.get_internal_async (true, cancellable);
}
public static Tracker.Sparql.Connection tracker_sparql_connection_get_direct (Cancellable? cancellable = null) throws Tracker.Sparql.Error, IOError, DBusError, SpawnError {
return Tracker.Sparql.Backend.get_internal (true, cancellable);
}
include $(top_srcdir)/Makefile.decl
modulesdir = $(libdir)/tracker-$(TRACKER_API_VERSION)/sparql-modules
lib_LTLIBRARIES = libtracker-sparql-@TRACKER_API_VERSION@.la
noinst_LTLIBRARIES = libtracker-sparql.la
AM_VALAFLAGS = \
--includedir=libtracker-sparql \
......@@ -10,35 +8,28 @@ AM_VALAFLAGS = \
--vapi tracker-sparql-$(TRACKER_API_VERSION).vapi \
--pkg gio-2.0 --pkg gmodule-2.0 --pkg posix \
$(BUILD_VALAFLAGS) \
config.vapi \
$(top_srcdir)/src/vapi/glib-2.0-fixes.vapi
AM_CPPFLAGS = \
$(BUILD_CFLAGS) \
-DSPARQL_MODULES_DIR=\""$(modulesdir)"\" \
-I$(top_srcdir)/src \
-I$(top_builddir)/src \
$(LIBTRACKER_SPARQL_CFLAGS)
libtracker_sparqlincludedir = $(includedir)/tracker-$(TRACKER_API_VERSION)/libtracker-sparql
libtracker_sparql_@TRACKER_API_VERSION@_la_SOURCES = \
libtracker_sparql_la_SOURCES = \
tracker-builder.vala \
tracker-connection.vala \
tracker-cursor.vala \
tracker-backend.vala \
tracker-utils.vala \
tracker-uri.c \
tracker-init.c
libtracker_sparql_@TRACKER_API_VERSION@_la_LIBADD = \
libtracker_sparql_la_LIBADD = \
$(BUILD_LIBS) \
$(LIBTRACKER_SPARQL_LIBS)
libtracker_sparql_@TRACKER_API_VERSION@_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
-export-symbols-regex '^tracker_sparql_(connection|cursor|builder|escape|error|value|get)_.*'
libtracker_sparqlinclude_HEADERS = \
tracker-sparql.h
......@@ -52,7 +43,7 @@ vapi_DATA = \
tracker-sparql-$(TRACKER_API_VERSION).deps
BUILT_SOURCES = \
libtracker_sparql_$(TRACKER_API_VERSION)_la_vala.stamp
libtracker_sparql_la_vala.stamp
MAINTAINERCLEANFILES = \
tracker-sparql-$(TRACKER_API_VERSION).vapi \
......@@ -60,7 +51,6 @@ MAINTAINERCLEANFILES = \
tracker-sparql.h
EXTRA_DIST = \
config.vapi \
tracker-sparql-$(TRACKER_API_VERSION).vapi \
tracker-sparql-$(TRACKER_API_VERSION).deps \
tracker-sparql.deps
/*
* Copyright (C) 2010, Nokia <ivan.frade@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
[CCode (cprefix = "", lower_case_cprefix = "")]
namespace Config {
public const string SPARQL_MODULES_DIR;
}
......@@ -80,101 +80,6 @@ public errordomain Tracker.Sparql.Error {
* non-direct requests.
*/
public abstract class Tracker.Sparql.Connection : Object {
static bool direct_only;
static weak Connection? singleton;
static bool log_initialized;
static StaticMutex door;
private static new Connection get_internal (bool is_direct_only = false, Cancellable? cancellable = null) throws Sparql.Error, IOError, DBusError, SpawnError {
door.lock ();
// assign to owned variable to ensure it doesn't get freed between unlock and return
var result = singleton;
if (result != null) {
assert (direct_only == is_direct_only);
door.unlock ();
return result;
}
log_init ();
/* the True is to assert that direct only is required */
result = new Backend (is_direct_only);
result.init ();
if (cancellable != null && cancellable.is_cancelled ()) {
door.unlock ();
throw new IOError.CANCELLED ("Operation was cancelled");
}
direct_only = is_direct_only;
singleton = result;
result.add_weak_pointer ((void**) (&singleton));
door.unlock ();
return singleton;
}
private async static new Connection get_internal_async (bool is_direct_only = false, Cancellable? cancellable = null) throws Sparql.Error, IOError, DBusError, SpawnError {
// fast path: avoid extra thread if connection is already available
if (door.trylock ()) {
// assign to owned variable to ensure it doesn't get freed between unlock and return
var result = singleton;
door.unlock ();
if (result != null) {
assert (direct_only == is_direct_only);
return result;
}
}
// run in a separate thread
Sparql.Error sparql_error = null;
IOError io_error = null;
DBusError dbus_error = null;
SpawnError spawn_error = null;
Connection result = null;
var context = MainContext.get_thread_default ();
g_io_scheduler_push_job (job => {
try {
result = get_internal (is_direct_only, cancellable);
} catch (IOError e_io) {
io_error = e_io;
} catch (Sparql.Error e_spql) {
sparql_error = e_spql;
} catch (DBusError e_dbus) {
dbus_error = e_dbus;
} catch (SpawnError e_spawn) {
spawn_error = e_spawn;
}
var source = new IdleSource ();
source.set_callback (() => {
get_internal_async.callback ();
return false;
});
source.attach (context);
return false;
});
yield;
if (sparql_error != null) {
throw sparql_error;
} else if (io_error != null) {
throw io_error;
} else if (dbus_error != null) {
throw dbus_error;
} else if (spawn_error != null) {
throw spawn_error;
} else {
return result;
}
}
/**
* tracker_sparql_connection_get_finish:
* @_res_: The #GAsyncResult from the callback used to return the #TrackerSparqlConnection
......@@ -205,9 +110,7 @@ public abstract class Tracker.Sparql.Connection : Object {
*
* Since: 0.10
*/
public async static new Connection get_async (Cancellable? cancellable = null) throws Sparql.Error, IOError, DBusError, SpawnError {
return yield get_internal_async (false, cancellable);
}
public extern async static new Connection get_async (Cancellable? cancellable = null) throws Sparql.Error, IOError, DBusError, SpawnError;