[tracker/tracker-store-queue] Wait before shutting down



commit 7128821b779e2e127b20ccdbd92156672767556f
Author: Philip Van Hoof <philip codeminded be>
Date:   Thu May 21 14:00:39 2009 +0200

    Wait before shutting down
---
 src/tracker-store/tracker-store-queue.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/src/tracker-store/tracker-store-queue.c b/src/tracker-store/tracker-store-queue.c
index c46023d..03effb0 100644
--- a/src/tracker-store/tracker-store-queue.c
+++ b/src/tracker-store/tracker-store-queue.c
@@ -57,7 +57,7 @@ typedef struct {
 } TrackerStoreQueueTask;
 
 static GStaticPrivate private_key = G_STATIC_PRIVATE_INIT;
-
+static gboolean im_done = TRUE;
 
 static void
 private_free (gpointer data)
@@ -148,6 +148,8 @@ queue_idle_destroy (gpointer user_data)
 	if (private->final) {
 		g_static_private_set (&private_key, NULL, NULL);
 	}
+
+	im_done = TRUE;
 }
 
 void
@@ -174,11 +176,21 @@ tracker_store_queue_shutdown (void)
 	g_return_if_fail (private != NULL);
 
 	private->final = TRUE;
+
+	if (!im_done) {
+		g_debug ("Can't exit until store-queue is finished ...");
+		while (!im_done) {
+			g_main_context_iteration (NULL, TRUE);
+		}
+		g_debug ("Store-queue finished");
+	}
 }
 
 static void
 start_handler (TrackerStoreQueuePrivate *private) 
 {
+	im_done = FALSE;
+
 	g_idle_add_full (G_PRIORITY_DEFAULT,
 	                 queue_idle_handler,
 	                 private,



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