Patch: Protect idle thread for the case store->idle_thread is not assigned on time
- From: José Dapena Paz <jdapena igalia com>
- To: tinymail-devel-list <tinymail-devel-list gnome org>
- Subject: Patch: Protect idle thread for the case store->idle_thread is not assigned on time
- Date: Thu, 30 Jul 2009 21:21:25 +0200
Hi,
This patch protects IMAP idle_thread a bit more. We just make sure the
CamelIMAPStore idle_thread reference is assigned before going into the
idle_thread work. The idea is making sure the code we use to know if
we're in the idle thread will work always.
Changelog entry:
* libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-folder.c
(idle_thread): loop while the store->idle_thread is not assigned, to
avoid unexpected behavior for not being able to detect if we're
starting or stopping idle from idle thread.
--
José Dapena Paz <jdapena igalia com>
Igalia
diff --git a/ChangeLog b/ChangeLog
index a6e98f1..0d8d458 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2009-07-30 Jose Dapena Paz <jdapena igalia com>
+ * libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-folder.c
+ (idle_thread): loop while the store->idle_thread is not assigned, to
+ avoid unexpected behavior for not being able to detect if we're
+ starting or stopping idle from idle thread.
+
* libtinymail-camel/tny-camel-folder.c: now folder_changed and
folder_tracking_changed events, being camel event handlers,
avoid doing any lock inside. What they do now is doing the
diff --git a/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-folder.c b/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-folder.c
index ebe17bb..b96664f 100644
--- a/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-folder.c
+++ b/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-folder.c
@@ -4099,6 +4099,9 @@ idle_thread (gpointer data)
}
+ while (store->idle_thread != g_thread_self ())
+ usleep (100);
+
/* We add our own reference because the calling thread will immediately
* after the GCond broadcast free the info (and its references). We add
* this reference 'before' we broadcast! Of course. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]