tracker r2189 - in branches/indexer-split: . src/tracker-indexer



Author: carlosg
Date: Fri Aug 29 13:48:21 2008
New Revision: 2189
URL: http://svn.gnome.org/viewvc/tracker?rev=2189&view=rev

Log:
2008-08-29  Carlos Garnacho  <carlos imendio com>

        * src/tracker-indexer/tracker-indexer.c (process_func)
        (tracker_indexer_check_state): If for some reason the indexer is
        stopped and started again somewhere inside process_func(), the indexer
        would end up with the current idle function "detached" but still
        running, and a new one. So, if we're inside process_func, we won't
        remove the idle function immediately, instead we'll wait and make the
        idle func return FALSE if the indexer should still be paused.


Modified:
   branches/indexer-split/ChangeLog
   branches/indexer-split/src/tracker-indexer/tracker-indexer.c

Modified: branches/indexer-split/src/tracker-indexer/tracker-indexer.c
==============================================================================
--- branches/indexer-split/src/tracker-indexer/tracker-indexer.c	(original)
+++ branches/indexer-split/src/tracker-indexer/tracker-indexer.c	Fri Aug 29 13:48:21 2008
@@ -136,6 +136,7 @@
 	guint items_processed;
 
 	guint in_transaction : 1;
+	guint in_process : 1;
 	guint state : 4;
 };
 
@@ -1810,6 +1811,8 @@
 
 	indexer = TRACKER_INDEXER (data);
 
+	indexer->private->in_process = TRUE;
+
 	if (G_UNLIKELY (!indexer->private->in_transaction)) {
 		start_transaction (indexer);
 	}
@@ -1850,6 +1853,14 @@
 		schedule_flush (indexer, TRUE);
 	}
 
+	indexer->private->in_process = TRUE;
+
+	if (indexer->private->state != 0) {
+		/* Some flag has been set, meaning the idle function should stop */
+		indexer->private->idle_id = 0;
+		return FALSE;
+	}
+
 	return TRUE;
 }
 
@@ -1887,7 +1898,14 @@
 		stop_scheduled_flush (indexer);
 		stop_transaction (indexer);
 
-		if (indexer->private->idle_id) {
+		/* Actually, we don't want to remove/add back the idle
+		 * function if we're in the middle of processing one item,
+		 * as we could end up with a detached idle function running
+		 * plus a newly created one, instead we don't remove the source
+		 * here and make the idle function return FALSE if any flag is set.
+		 */
+		if (indexer->private->idle_id &&
+		    !indexer->private->in_process) {
 			g_source_remove (indexer->private->idle_id);
 			indexer->private->idle_id = 0;
 		}



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