diff options
-rw-r--r-- | mail/e-mail-backend.c | 4 | ||||
-rw-r--r-- | mail/mail-mt.c | 53 | ||||
-rw-r--r-- | mail/mail-mt.h | 4 |
3 files changed, 7 insertions, 54 deletions
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c index 8012cc79af..4dab31ca8a 100644 --- a/mail/e-mail-backend.c +++ b/mail/e-mail-backend.c @@ -196,7 +196,7 @@ mail_backend_final_sync (CamelStore *store, static gboolean mail_backend_poll_to_quit (EActivity *activity) { - return mail_msg_active ((guint) -1); + return mail_msg_active (); } /* Helper for mail_backend_prepare_for_quit_cb() */ @@ -249,7 +249,7 @@ mail_backend_prepare_for_quit_cb (EShell *shell, /* Now we poll until all activities are actually cancelled. * Reffing the activity delays quitting; the reference count * acts like a counting semaphore. */ - if (mail_msg_active ((guint) -1)) + if (mail_msg_active ()) g_timeout_add_seconds_full ( G_PRIORITY_DEFAULT, QUIT_POLL_INTERVAL, (GSourceFunc) mail_backend_poll_to_quit, diff --git a/mail/mail-mt.c b/mail/mail-mt.c index d5f1761e35..60938abc22 100644 --- a/mail/mail-mt.c +++ b/mail/mail-mt.c @@ -346,39 +346,18 @@ mail_msg_wait (guint msgid) } } -gint mail_msg_active (guint msgid) +gboolean +mail_msg_active (void) { - gint active; + gboolean active; g_mutex_lock (mail_msg_lock); - if (msgid == (guint)-1) - active = g_hash_table_size (mail_msg_active_table) > 0; - else - active = g_hash_table_lookup (mail_msg_active_table, GINT_TO_POINTER (msgid)) != NULL; + active = g_hash_table_size (mail_msg_active_table) > 0; g_mutex_unlock (mail_msg_lock); return active; } -void mail_msg_wait_all (void) -{ - if (mail_in_main_thread ()) { - g_mutex_lock (mail_msg_lock); - while (g_hash_table_size (mail_msg_active_table) > 0) { - g_mutex_unlock (mail_msg_lock); - gtk_main_iteration (); - g_mutex_lock (mail_msg_lock); - } - g_mutex_unlock (mail_msg_lock); - } else { - g_mutex_lock (mail_msg_lock); - while (g_hash_table_size (mail_msg_active_table) > 0) { - g_cond_wait (mail_msg_cond, mail_msg_lock); - } - g_mutex_unlock (mail_msg_lock); - } -} - /* **************************************** */ static GHookList cancel_hook_list; @@ -508,30 +487,6 @@ mail_msg_proxy (MailMsg *msg) } void -mail_msg_cleanup (void) -{ - mail_msg_wait_all (); - - G_LOCK (idle_source_id); - if (idle_source_id != 0) { - GSource *source; - - /* Cancel the idle source. */ - source = g_main_context_find_source_by_id ( - g_main_context_default (), idle_source_id); - g_source_destroy (source); - idle_source_id = 0; - } - G_UNLOCK (idle_source_id); - - g_async_queue_unref (main_loop_queue); - main_loop_queue = NULL; - - g_async_queue_unref (msg_reply_queue); - msg_reply_queue = NULL; -} - -void mail_msg_init (void) { mail_msg_lock = g_mutex_new (); diff --git a/mail/mail-mt.h b/mail/mail-mt.h index e31d9e9506..de00eec5a6 100644 --- a/mail/mail-mt.h +++ b/mail/mail-mt.h @@ -55,7 +55,6 @@ struct _MailMsgInfo { /* setup ports */ void mail_msg_init (void); -void mail_msg_cleanup (void); gboolean mail_in_main_thread (void); @@ -66,8 +65,7 @@ void mail_msg_unref (gpointer msg); void mail_msg_check_error (gpointer msg); void mail_msg_cancel (guint msgid); void mail_msg_wait (guint msgid); -void mail_msg_wait_all (void); -gint mail_msg_active (guint msgid); +gboolean mail_msg_active (void); /* dispatch a message */ void mail_msg_main_loop_push (gpointer msg); |