[tracker/dont-interrupt-create-statement] squash



commit 55ce122ddc1d4b9c9a64908102ad5bd086ffd919
Author: Philip Van Hoof <philip codeminded be>
Date:   Mon May 24 15:38:12 2010 +0200

    squash

 src/libtracker-db/tracker-db-interface-sqlite.c |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-db/tracker-db-interface-sqlite.c b/src/libtracker-db/tracker-db-interface-sqlite.c
index 0291541..ba951a6 100644
--- a/src/libtracker-db/tracker-db-interface-sqlite.c
+++ b/src/libtracker-db/tracker-db-interface-sqlite.c
@@ -82,6 +82,7 @@ struct TrackerDBInterfaceSqlitePrivate {
 	guint ro : 1;
 	guint fts_initialized : 1;
 	GMutex *interrupt_mutex;
+	gboolean interrupt;
 };
 
 struct TrackerDBStatementSqlitePrivate {
@@ -488,6 +489,21 @@ function_sparql_regex (sqlite3_context *context,
 	sqlite3_result_int (context, ret);
 }
 
+static int
+check_interrupt (void *user_data)
+{
+	TrackerDBInterfaceSqlitePrivate *priv = user_data;
+	gint ret = 0;
+
+	g_mutex_lock (priv->interrupt_mutex);
+	if (priv->interrupt) {
+		ret = 1;
+		priv->interrupt = FALSE;
+	}
+	g_mutex_unlock (priv->interrupt_mutex);
+
+	return ret;
+}
 
 static void
 open_database (TrackerDBInterfaceSqlitePrivate *priv)
@@ -510,6 +526,8 @@ open_database (TrackerDBInterfaceSqlitePrivate *priv)
 		}
 	}
 
+	sqlite3_progress_handler (priv->db, 0, check_interrupt, priv);
+
 	sqlite3_create_function (priv->db, "SparqlRegex", 3, SQLITE_ANY,
 	                         priv, &function_sparql_regex,
 	                         NULL, NULL);
@@ -922,7 +940,7 @@ tracker_db_interface_sqlite_interrupt (TrackerDBInterface *iface)
 	priv = TRACKER_DB_INTERFACE_SQLITE_GET_PRIVATE (iface);
 
 	g_mutex_lock (priv->interrupt_mutex);
-	sqlite3_interrupt (priv->db);
+	priv->interrupt = TRUE;
 	g_mutex_unlock (priv->interrupt_mutex);
 
 	return TRUE;



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