[maemo-commits] [maemo-commits] r18570 - in projects/haf/trunk/hildon-thumbnail: . daemon

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Jun 2 12:43:34 EEST 2009
Author: pvanhoof
Date: 2009-06-02 12:43:31 +0300 (Tue, 02 Jun 2009)
New Revision: 18570

Modified:
   projects/haf/trunk/hildon-thumbnail/ChangeLog
   projects/haf/trunk/hildon-thumbnail/daemon/thumbnailer.c
Log:
2009-06-02  Philip Van Hoof  <philip at codeminded.be>

        * daemon/thumbnailer.c: Wait per thumbnail



Modified: projects/haf/trunk/hildon-thumbnail/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-thumbnail/ChangeLog	2009-06-01 14:02:42 UTC (rev 18569)
+++ projects/haf/trunk/hildon-thumbnail/ChangeLog	2009-06-02 09:43:31 UTC (rev 18570)
@@ -1,3 +1,7 @@
+2009-06-02  Philip Van Hoof  <philip at codeminded.be>
+
+	* daemon/thumbnailer.c: Wait per thumbnail
+
 2009-06-01  Marius Vollmer  <marius.vollmer at nokia.com>
 
 	Released 3.0.30

Modified: projects/haf/trunk/hildon-thumbnail/daemon/thumbnailer.c
===================================================================
--- projects/haf/trunk/hildon-thumbnail/daemon/thumbnailer.c	2009-06-01 14:02:42 UTC (rev 18569)
+++ projects/haf/trunk/hildon-thumbnail/daemon/thumbnailer.c	2009-06-02 09:43:31 UTC (rev 18570)
@@ -27,8 +27,6 @@
 #include "config.h"
 #endif
 
-//#define HAVE_OSSO
-
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
@@ -68,11 +66,15 @@
 	GList *tasks;
 #ifdef HAVE_OSSO
 	GMutex *cmutex;
-	gboolean waiting;
+	gboolean waiting, must_wait;
 	GCond *cond;
 #endif
 } ThumbnailerPrivate;
 
+#ifdef HAVE_OSSO
+static __thread int big_thread = 0;
+#endif
+
 enum {
 	PROP_0,
 	PROP_MANAGER
@@ -564,6 +566,16 @@
 		guint64 mtime_x = 0;
 		gchar *mhint = NULL;
 
+#ifdef HAVE_OSSO
+		if (big_thread && priv->must_wait) {
+			g_mutex_lock (priv->cmutex);
+			priv->waiting = TRUE;
+			g_debug ("Big-queue thread waiting for Tracker to finish Indexing (Maemo specific)");
+			g_cond_wait (priv->cond, priv->cmutex);
+			g_mutex_unlock (priv->cmutex);
+		}
+#endif
+
 		hildon_thumbnail_util_get_thumb_paths (urls[i], &large, &normal, &cropped, 
 						       NULL, NULL, NULL, FALSE);
 
@@ -976,11 +988,7 @@
 	ThumbnailerPrivate *priv = THUMBNAILER_GET_PRIVATE (task->object);
 
 #ifdef HAVE_OSSO
-	g_mutex_lock (priv->cmutex);
-	priv->waiting = TRUE;
-	g_debug ("Big-queue thread waiting for Tracker to finish Indexing (Maemo specific)");
-	g_cond_wait (priv->cond, priv->cmutex);
-	g_mutex_unlock (priv->cmutex);
+	big_thread = 1;
 #endif
 
 	initialize_priority ();
@@ -1294,6 +1302,7 @@
 	priv->cmutex = g_mutex_new ();
 	priv->cond = g_cond_new ();
 	priv->waiting = FALSE;
+	priv->must_wait = FALSE;
 #endif
 
 	priv->plugins_perscheme = g_hash_table_new_full (g_str_hash, g_str_equal,
@@ -1317,9 +1326,10 @@
 			     gboolean in_merge, gboolean is_man_paused, gboolean is_bat_paused,
 			     gboolean is_io_paused, gboolean is_indx_en, gpointer user_data)
 {
+	Thumbnailer *object = user_data;
+	ThumbnailerPrivate *priv = THUMBNAILER_GET_PRIVATE (object);
+
 	if (g_strcmp0 (state, "Idle") == 0) {
-		Thumbnailer *object = user_data;
-		ThumbnailerPrivate *priv = THUMBNAILER_GET_PRIVATE (object);
 
 		g_mutex_lock (priv->cmutex);
 		if (priv->waiting) {
@@ -1328,6 +1338,10 @@
 			priv->waiting = FALSE;
 		}
 		g_mutex_unlock (priv->cmutex);
+
+		priv->must_wait = FALSE;
+	} else {
+		priv->must_wait = TRUE;
 	}
 }
 #endif


More information about the maemo-commits mailing list