[tracker/clientapi] No more locking the mainloop of Evolution's process



commit e685355d46e545047daefcc8f61aa87f2564e7e3
Author: Philip Van Hoof <philip codeminded be>
Date:   Tue Jan 12 15:01:23 2010 +0100

    No more locking the mainloop of Evolution's process

 src/libtracker-client/tracker.c                  |    2 +-
 src/plugins/evolution/tracker-evolution-plugin.c |   56 ++++++++++------------
 2 files changed, 26 insertions(+), 32 deletions(-)
---
diff --git a/src/libtracker-client/tracker.c b/src/libtracker-client/tracker.c
index 2f39b34..e41ab6a 100644
--- a/src/libtracker-client/tracker.c
+++ b/src/libtracker-client/tracker.c
@@ -213,7 +213,7 @@ tracker_client_set_property (GObject      *object,
 
 	switch (prop_id) {
 	case PROP_ENABLE_WARNINGS:
-			priv->enable_warnings = g_value_get_boolean (value);
+		priv->enable_warnings = g_value_get_boolean (value);
 		break;
 	case PROP_TIMEOUT:
 		val = g_value_get_int (value);
diff --git a/src/plugins/evolution/tracker-evolution-plugin.c b/src/plugins/evolution/tracker-evolution-plugin.c
index d2037b5..3d47194 100644
--- a/src/plugins/evolution/tracker-evolution-plugin.c
+++ b/src/plugins/evolution/tracker-evolution-plugin.c
@@ -308,7 +308,7 @@ folder_registry_new (const gchar *account_uri,
 }
 
 typedef struct {
-	TrackerEvolutionPlugin *self;
+	TrackerClient *client;
 	gchar *sparql;
 	gboolean commit;
 } PoolItem;
@@ -317,46 +317,41 @@ static void
 exec_update (gpointer data, gpointer user_data)
 {
 	PoolItem *item = data;
-	TrackerEvolutionPluginPrivate *priv = TRACKER_EVOLUTION_PLUGIN_GET_PRIVATE (item->self);
-
-	g_static_rec_mutex_lock (priv->mutex);
-
-	if (priv->client) {
-		GError *error = NULL;
+	GError *error = NULL;
 
-		if (item->commit) {
-			tracker_resources_batch_commit (priv->client, &error);
-		} else {
-			tracker_resources_batch_sparql_update (priv->client, item->sparql, &error);
-		}
+	if (item->commit) {
+		tracker_resources_batch_commit (item->client, &error);
+	} else {
+		tracker_resources_batch_sparql_update (item->client, item->sparql, &error);
+	}
 
-		if (error) {
-			g_warning ("Error updating data: %s\n", error->message);
-			g_error_free (error);
-		}
+	if (error) {
+		g_warning ("Error updating data: %s\n", error->message);
+		g_error_free (error);
 	}
-	g_static_rec_mutex_unlock (priv->mutex);
 
 	g_free (item->sparql);
-	g_object_unref (item->self);
+	g_object_unref (item->client);
 	g_slice_free (PoolItem, item);
 }
 
 static void
 send_sparql_update (TrackerEvolutionPlugin *self, const gchar *sparql)
 {
-	PoolItem *item = g_slice_new (PoolItem);
-
-	if (!pool) {
-		pool = g_thread_pool_new (exec_update, NULL, 1, FALSE, NULL);
-	}
+	TrackerEvolutionPluginPrivate *priv = TRACKER_EVOLUTION_PLUGIN_GET_PRIVATE (self);
 
-	item->commit = FALSE;
-	item->self = g_object_ref (self);
-	item->sparql = g_strdup (sparql);
+	if (priv->client) {
+		PoolItem *item = g_slice_new (PoolItem);
+		if (!pool) {
+			pool = g_thread_pool_new (exec_update, NULL, 1, FALSE, NULL);
+		}
 
-	g_thread_pool_push (pool, item, NULL);
+		item->commit = FALSE;
+		item->client = g_object_ref (priv->client);
+		item->sparql = g_strdup (sparql);
 
+		g_thread_pool_push (pool, item, NULL);
+	}
 }
 
 static void
@@ -380,13 +375,12 @@ send_sparql_commit (TrackerEvolutionPlugin *self, gboolean update)
 			g_free (date_s);
 		}
 
-
 		if (!pool) {
 			pool = g_thread_pool_new (exec_update, NULL, 1, FALSE, NULL);
 		}
 
 		item->commit = TRUE;
-		item->self = g_object_ref (self);
+		item->client = g_object_ref (priv->client);
 		item->sparql = NULL;
 
 		g_thread_pool_push (pool, item, NULL);
@@ -1091,7 +1085,7 @@ introduce_walk_folders_in_folder (TrackerEvolutionPlugin *self,
 					 * in the mainloop. Therefore, yield he mainloop
 					 * sometimes, indeed */
 
-					g_main_context_iteration (NULL, TRUE);
+					// g_main_context_iteration (NULL, TRUE);
 
 					more = TRUE;
 					break;
@@ -1230,7 +1224,7 @@ introduce_store_deal_with_deleted (TrackerEvolutionPlugin *self,
 				 * in the mainloop. Therefore, yield he mainloop
 				 * sometimes, indeed */
 
-				g_main_context_iteration (NULL, TRUE);
+				// g_main_context_iteration (NULL, TRUE);
 
 				more = TRUE;
 				break;



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