[tracker/async-queries-due] TrackerDBInterface: Add interrupt() method.



commit 5358421ae17f1f2a749380a1d76fd127d6541da9
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Apr 16 13:55:56 2010 +0200

    TrackerDBInterface: Add interrupt() method.
    
    This should be callable from other threads.

 src/libtracker-db/tracker-db-interface.c |   15 +++++++++++++++
 src/libtracker-db/tracker-db-interface.h |    3 +++
 2 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-db/tracker-db-interface.c b/src/libtracker-db/tracker-db-interface.c
index 31fe495..727391a 100644
--- a/src/libtracker-db/tracker-db-interface.c
+++ b/src/libtracker-db/tracker-db-interface.c
@@ -311,6 +311,21 @@ tracker_db_interface_execute_query (TrackerDBInterface  *interface,
 }
 
 gboolean
+tracker_db_interface_interrupt (TrackerDBInterface *interface)
+{
+	g_return_val_if_fail (TRACKER_IS_DB_INTERFACE (interface), FALSE);
+
+	if (!TRACKER_DB_INTERFACE_GET_IFACE (interface)->interrupt) {
+		g_critical ("Database abstraction %s doesn't implement "
+		            "the method interrupt()",
+		            G_OBJECT_TYPE_NAME (interface));
+		return FALSE;
+	}
+
+	return TRACKER_DB_INTERFACE_GET_IFACE (interface)->interrupt (interface);
+}
+
+gboolean
 tracker_db_interface_start_transaction (TrackerDBInterface *interface)
 {
 	GError *error = NULL;
diff --git a/src/libtracker-db/tracker-db-interface.h b/src/libtracker-db/tracker-db-interface.h
index d92b4ef..5c2586d 100644
--- a/src/libtracker-db/tracker-db-interface.h
+++ b/src/libtracker-db/tracker-db-interface.h
@@ -75,6 +75,7 @@ struct TrackerDBInterfaceIface {
 	TrackerDBResultSet * (* execute_query)    (TrackerDBInterface  *interface,
 	                                           GError             **error,
 	                                           const gchar         *query);
+        gboolean             (* interrupt)        (TrackerDBInterface  *interface);
 };
 
 struct TrackerDBStatementIface {
@@ -147,6 +148,8 @@ TrackerDBResultSet *tracker_db_interface_execute_query     (TrackerDBInterface
                                                             const gchar                *query,
                                                             ...) G_GNUC_PRINTF (3, 4);
 
+gboolean            tracker_db_interface_interrupt         (TrackerDBInterface  *interface);
+
 gboolean            tracker_db_interface_start_transaction (TrackerDBInterface  *interface);
 gboolean            tracker_db_interface_end_db_transaction   (TrackerDBInterface  *interface);
 void                tracker_db_statement_bind_double       (TrackerDBStatement  *stmt,



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