[tracker] Timed waiting on the GCond in the Evolution plugin, just in case



commit 06a9c89c88d188237c5547b03afe402676580a53
Author: Philip Van Hoof <philip codeminded be>
Date:   Fri Jan 22 14:49:59 2010 +0100

    Timed waiting on the GCond in the Evolution plugin, just in case

 src/plugins/evolution/tracker-evolution-plugin.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/evolution/tracker-evolution-plugin.c b/src/plugins/evolution/tracker-evolution-plugin.c
index 93458b3..89b4603 100644
--- a/src/plugins/evolution/tracker-evolution-plugin.c
+++ b/src/plugins/evolution/tracker-evolution-plugin.c
@@ -367,6 +367,7 @@ exec_update (gpointer data, gpointer user_data)
 {
 	PoolItem *item = data;
 	GCancellable *cancel = user_data;
+	gboolean no_patience = TRUE;
 
 	if (g_cancellable_is_cancelled (cancel))
 		return;
@@ -383,14 +384,19 @@ exec_update (gpointer data, gpointer user_data)
 	}
 
 	g_mutex_lock (item->mutex);
-	if (!item->has_happened)
-		g_cond_wait (item->cond, item->mutex);
+	if (!item->has_happened) {
+		GTimeVal val;
+		g_get_current_time (&val);
+		g_time_val_add (&val, 5 * 1000000); /* 5 seconds worth of patience */
+		no_patience = g_cond_timed_wait (item->cond, item->mutex, &val);
+	}
 	g_mutex_unlock (item->mutex);
 
 	/* Don't hammer DBus too much, else Evolution's UI sometimes becomes slugish
 	 * due to a dbus_watch_handle call on its mainloop */
 
-	g_usleep (300);
+	if (no_patience)
+		g_usleep (300);
 }
 
 static gint 



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