From 9e0e08e201f853239fe02b7e694d3e1eac770e47 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Fri, 08 Feb 2013 11:07:39 +0000 Subject: Bug #683867 - Schedule actions with higher idle priority --- diff --git a/calendar/libecal/e-cal.c b/calendar/libecal/e-cal.c index 3c43bed..b956550 100644 --- a/calendar/libecal/e-cal.c +++ b/calendar/libecal/e-cal.c @@ -1151,7 +1151,7 @@ async_report_idle (ECal *ecal, data->ecal = g_object_ref (ecal); data->error = error; - g_idle_add (idle_async_error_reply_cb, data); + g_idle_add_full (G_PRIORITY_DEFAULT, idle_async_error_reply_cb, data, NULL); } /** diff --git a/camel/camel-folder.c b/camel/camel-folder.c index a262b02..9788c96 100644 --- a/camel/camel-folder.c +++ b/camel/camel-folder.c @@ -2782,7 +2782,7 @@ camel_folder_search_free (CamelFolder *folder, * Marks @folder as deleted and performs any required cleanup. * * This also emits the #CamelFolder::deleted signal from an idle source on - * the main loop. The idle source's priority is #G_PRIORITY_DEFAULT_IDLE. + * the main loop. The idle source's priority is #G_PRIORITY_DEFAULT. **/ void camel_folder_delete (CamelFolder *folder) @@ -2823,7 +2823,7 @@ camel_folder_delete (CamelFolder *folder) signal_data->folder = g_object_ref (folder); camel_session_idle_add ( - session, G_PRIORITY_DEFAULT_IDLE, + session, G_PRIORITY_DEFAULT, folder_emit_deleted_cb, signal_data, (GDestroyNotify) signal_data_free); } @@ -2836,7 +2836,7 @@ camel_folder_delete (CamelFolder *folder) * Marks @folder as renamed. * * This also emits the #CamelFolder::renamed signal from an idle source on - * the main loop. The idle source's priority is #G_PRIORITY_DEFAULT_IDLE. + * the main loop. The idle source's priority is #G_PRIORITY_DEFAULT. * * NOTE: This is an internal function used by camel stores, no locking * is performed on the folder. @@ -2873,7 +2873,7 @@ camel_folder_rename (CamelFolder *folder, signal_data->folder_name = old_name; /* transfer ownership */ camel_session_idle_add ( - session, G_PRIORITY_DEFAULT_IDLE, + session, G_PRIORITY_DEFAULT, folder_emit_renamed_cb, signal_data, (GDestroyNotify) signal_data_free); } diff --git a/camel/camel-imapx-server.c b/camel/camel-imapx-server.c index 75b73f6..2708f16 100644 --- a/camel/camel-imapx-server.c +++ b/camel/camel-imapx-server.c @@ -6284,7 +6284,7 @@ imapx_server_dispose (GObject *object) if (server->parser_thread) { if (server->parser_thread == g_thread_self ()) - g_idle_add (&join_helper, server->parser_thread); + g_idle_add_full (G_PRIORITY_HIGH, &join_helper, server->parser_thread, NULL); else g_thread_join (server->parser_thread); server->parser_thread = NULL; diff --git a/camel/camel-service.c b/camel/camel-service.c index 316b688..6fed559 100644 --- a/camel/camel-service.c +++ b/camel/camel-service.c @@ -409,7 +409,7 @@ service_queue_notify_connection_status (CamelService *service) session = camel_service_get_session (service); camel_session_idle_add ( - session, G_PRIORITY_DEFAULT_IDLE, + session, G_PRIORITY_DEFAULT, service_notify_connection_status_cb, g_object_ref (service), (GDestroyNotify) g_object_unref); diff --git a/camel/camel-session.c b/camel/camel-session.c index abcf34f..ba65eb8 100644 --- a/camel/camel-session.c +++ b/camel/camel-session.c @@ -53,7 +53,7 @@ (G_TYPE_INSTANCE_GET_PRIVATE \ ((obj), CAMEL_TYPE_SESSION, CamelSessionPrivate)) -#define JOB_PRIORITY G_PRIORITY_LOW +#define JOB_PRIORITY G_PRIORITY_DEFAULT #define d(x) diff --git a/camel/camel-store.c b/camel/camel-store.c index b74126f..e80a304 100644 --- a/camel/camel-store.c +++ b/camel/camel-store.c @@ -1268,7 +1268,7 @@ camel_store_error_quark (void) * @folder_info: information about the created folder * * Emits the #CamelStore::folder-created signal from an idle source on - * the main loop. The idle source's priority is #G_PRIORITY_DEFAULT_IDLE. + * the main loop. The idle source's priority is #G_PRIORITY_DEFAULT. * * This function is only intended for Camel providers. * @@ -1291,7 +1291,7 @@ camel_store_folder_created (CamelStore *store, signal_data->folder_info = camel_folder_info_clone (folder_info); camel_session_idle_add ( - session, G_PRIORITY_DEFAULT_IDLE, + session, G_PRIORITY_DEFAULT, store_emit_folder_created_cb, signal_data, (GDestroyNotify) signal_data_free); } @@ -1302,7 +1302,7 @@ camel_store_folder_created (CamelStore *store, * @folder_info: information about the deleted folder * * Emits the #CamelStore::folder-deleted signal from an idle source on - * the main loop. The idle source's priority is #G_PRIORITY_DEFAULT_IDLE. + * the main loop. The idle source's priority is #G_PRIORITY_DEFAULT. * * This function is only intended for Camel providers. * @@ -1325,7 +1325,7 @@ camel_store_folder_deleted (CamelStore *store, signal_data->folder_info = camel_folder_info_clone (folder_info); camel_session_idle_add ( - session, G_PRIORITY_DEFAULT_IDLE, + session, G_PRIORITY_DEFAULT, store_emit_folder_deleted_cb, signal_data, (GDestroyNotify) signal_data_free); } @@ -1336,7 +1336,7 @@ camel_store_folder_deleted (CamelStore *store, * @folder: the #CamelFolder that was opened * * Emits the #CamelStore::folder-opened signal from an idle source on - * the main loop. The idle source's priority is #G_PRIORITY_DEFAULT_IDLE. + * the main loop. The idle source's priority is #G_PRIORITY_DEFAULT. * * This function is only intended for Camel providers. * @@ -1359,7 +1359,7 @@ camel_store_folder_opened (CamelStore *store, signal_data->folder = g_object_ref (folder); camel_session_idle_add ( - session, G_PRIORITY_DEFAULT_IDLE, + session, G_PRIORITY_DEFAULT, store_emit_folder_opened_cb, signal_data, (GDestroyNotify) signal_data_free); } @@ -1371,7 +1371,7 @@ camel_store_folder_opened (CamelStore *store, * @folder_info: information about the renamed folder * * Emits the #CamelStore::folder-renamed signal from an idle source on - * the main loop. The idle source's priority is #G_PRIORITY_DEFAULT_IDLE. + * the main loop. The idle source's priority is #G_PRIORITY_DEFAULT. * * This function is only intended for Camel providers. * @@ -1397,7 +1397,7 @@ camel_store_folder_renamed (CamelStore *store, signal_data->folder_name = g_strdup (old_name); camel_session_idle_add ( - session, G_PRIORITY_DEFAULT_IDLE, + session, G_PRIORITY_DEFAULT, store_emit_folder_renamed_cb, signal_data, (GDestroyNotify) signal_data_free); } diff --git a/camel/camel-subscribable.c b/camel/camel-subscribable.c index ceb18d0..b73395e 100644 --- a/camel/camel-subscribable.c +++ b/camel/camel-subscribable.c @@ -611,7 +611,7 @@ camel_subscribable_unsubscribe_folder_finish (CamelSubscribable *subscribable, * @folder_info: information about the subscribed folder * * Emits the #CamelSubscribable::folder-subscribed signal from an idle source - * on the main loop. The idle source's priority is #G_PRIORITY_DEFAULT_IDLE. + * on the main loop. The idle source's priority is #G_PRIORITY_DEFAULT. * * This function is only intended for Camel providers. * @@ -636,7 +636,7 @@ camel_subscribable_folder_subscribed (CamelSubscribable *subscribable, signal_data->folder_info = camel_folder_info_clone (folder_info); camel_session_idle_add ( - session, G_PRIORITY_DEFAULT_IDLE, + session, G_PRIORITY_DEFAULT, subscribable_emit_folder_subscribed_cb, signal_data, (GDestroyNotify) signal_data_free); } @@ -647,7 +647,7 @@ camel_subscribable_folder_subscribed (CamelSubscribable *subscribable, * @folder_info: information about the unsubscribed folder * * Emits the #CamelSubscribable::folder-unsubscribed signal from an idle source - * on the main loop. The idle source's priority is #G_PRIORITY_DEFAULT_IDLE. + * on the main loop. The idle source's priority is #G_PRIORITY_DEFAULT. * * This function is only intended for Camel providers. * @@ -672,7 +672,7 @@ camel_subscribable_folder_unsubscribed (CamelSubscribable *subscribable, signal_data->folder_info = camel_folder_info_clone (folder_info); camel_session_idle_add ( - session, G_PRIORITY_DEFAULT_IDLE, + session, G_PRIORITY_DEFAULT, subscribable_emit_folder_unsubscribed_cb, signal_data, (GDestroyNotify) signal_data_free); } diff --git a/libedataserver/e-gdbus-templates.c b/libedataserver/e-gdbus-templates.c index ef3e476..5d99703 100644 --- a/libedataserver/e-gdbus-templates.c +++ b/libedataserver/e-gdbus-templates.c @@ -1015,7 +1015,7 @@ e_gdbus_op_cancelled_cb (GCancellable *cancellable, /* do this on idle, because this callback should be left * as soon as possible, with no sync calls being done */ - op_data->cancel_idle_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, e_gdbus_op_cancelled_idle_cb, cd, cancel_data_free); + op_data->cancel_idle_id = g_idle_add_full (G_PRIORITY_DEFAULT, e_gdbus_op_cancelled_idle_cb, cd, cancel_data_free); } static void -- cgit v0.9.0.2 From 03fcc5f17581b6b1b50a11bd46cc46ddb4289391 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 08 Feb 2013 16:34:48 +0000 Subject: Add comments around g_idle_add() changes --- diff --git a/calendar/libecal/e-cal.c b/calendar/libecal/e-cal.c index b956550..c54011a 100644 --- a/calendar/libecal/e-cal.c +++ b/calendar/libecal/e-cal.c @@ -1151,6 +1151,7 @@ async_report_idle (ECal *ecal, data->ecal = g_object_ref (ecal); data->error = error; + /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE) */ g_idle_add_full (G_PRIORITY_DEFAULT, idle_async_error_reply_cb, data, NULL); } diff --git a/camel/camel-folder.c b/camel/camel-folder.c index 9788c96..8c2a31c 100644 --- a/camel/camel-folder.c +++ b/camel/camel-folder.c @@ -2822,6 +2822,8 @@ camel_folder_delete (CamelFolder *folder) signal_data = g_slice_new0 (SignalData); signal_data->folder = g_object_ref (folder); + /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE), + same as GAsyncResult, where this operation is quite similar to it anyway */ camel_session_idle_add ( session, G_PRIORITY_DEFAULT, folder_emit_deleted_cb, @@ -2872,6 +2874,8 @@ camel_folder_rename (CamelFolder *folder, signal_data->folder = g_object_ref (folder); signal_data->folder_name = old_name; /* transfer ownership */ + /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE), + same as GAsyncResult, where this operation is quite similar to it anyway */ camel_session_idle_add ( session, G_PRIORITY_DEFAULT, folder_emit_renamed_cb, diff --git a/camel/camel-imapx-server.c b/camel/camel-imapx-server.c index 2708f16..1d16189 100644 --- a/camel/camel-imapx-server.c +++ b/camel/camel-imapx-server.c @@ -6284,6 +6284,7 @@ imapx_server_dispose (GObject *object) if (server->parser_thread) { if (server->parser_thread == g_thread_self ()) + /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE) */ g_idle_add_full (G_PRIORITY_HIGH, &join_helper, server->parser_thread, NULL); else g_thread_join (server->parser_thread); diff --git a/camel/camel-service.c b/camel/camel-service.c index 6fed559..e23cb31 100644 --- a/camel/camel-service.c +++ b/camel/camel-service.c @@ -408,6 +408,8 @@ service_queue_notify_connection_status (CamelService *service) session = camel_service_get_session (service); + /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE), + same as GAsyncResult, where this operation is quite similar to it anyway */ camel_session_idle_add ( session, G_PRIORITY_DEFAULT, service_notify_connection_status_cb, diff --git a/camel/camel-session.c b/camel/camel-session.c index ba65eb8..48c39fb 100644 --- a/camel/camel-session.c +++ b/camel/camel-session.c @@ -53,6 +53,8 @@ (G_TYPE_INSTANCE_GET_PRIVATE \ ((obj), CAMEL_TYPE_SESSION, CamelSessionPrivate)) +/* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE), + same as GAsyncResult, where this operation is quite similar to it anyway */ #define JOB_PRIORITY G_PRIORITY_DEFAULT #define d(x) diff --git a/camel/camel-store.c b/camel/camel-store.c index e80a304..7015fd2 100644 --- a/camel/camel-store.c +++ b/camel/camel-store.c @@ -1290,6 +1290,8 @@ camel_store_folder_created (CamelStore *store, signal_data->store = g_object_ref (store); signal_data->folder_info = camel_folder_info_clone (folder_info); + /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE), + same as GAsyncResult, where this operation is quite similar to it anyway */ camel_session_idle_add ( session, G_PRIORITY_DEFAULT, store_emit_folder_created_cb, @@ -1324,6 +1326,8 @@ camel_store_folder_deleted (CamelStore *store, signal_data->store = g_object_ref (store); signal_data->folder_info = camel_folder_info_clone (folder_info); + /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE), + same as GAsyncResult, where this operation is quite similar to it anyway */ camel_session_idle_add ( session, G_PRIORITY_DEFAULT, store_emit_folder_deleted_cb, @@ -1358,6 +1362,8 @@ camel_store_folder_opened (CamelStore *store, signal_data->store = g_object_ref (store); signal_data->folder = g_object_ref (folder); + /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE), + same as GAsyncResult, where this operation is quite similar to it anyway */ camel_session_idle_add ( session, G_PRIORITY_DEFAULT, store_emit_folder_opened_cb, @@ -1396,6 +1402,8 @@ camel_store_folder_renamed (CamelStore *store, signal_data->folder_info = camel_folder_info_clone (folder_info); signal_data->folder_name = g_strdup (old_name); + /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE), + same as GAsyncResult, where this operation is quite similar to it anyway */ camel_session_idle_add ( session, G_PRIORITY_DEFAULT, store_emit_folder_renamed_cb, diff --git a/camel/camel-subscribable.c b/camel/camel-subscribable.c index b73395e..470a4e0 100644 --- a/camel/camel-subscribable.c +++ b/camel/camel-subscribable.c @@ -635,6 +635,8 @@ camel_subscribable_folder_subscribed (CamelSubscribable *subscribable, signal_data->subscribable = g_object_ref (subscribable); signal_data->folder_info = camel_folder_info_clone (folder_info); + /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE), + same as GAsyncResult, where this operation is quite similar to it anyway */ camel_session_idle_add ( session, G_PRIORITY_DEFAULT, subscribable_emit_folder_subscribed_cb, @@ -671,6 +673,8 @@ camel_subscribable_folder_unsubscribed (CamelSubscribable *subscribable, signal_data->subscribable = g_object_ref (subscribable); signal_data->folder_info = camel_folder_info_clone (folder_info); + /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE), + same as GAsyncResult, where this operation is quite similar to it anyway */ camel_session_idle_add ( session, G_PRIORITY_DEFAULT, subscribable_emit_folder_unsubscribed_cb, diff --git a/libedataserver/e-gdbus-templates.c b/libedataserver/e-gdbus-templates.c index 5d99703..d741001 100644 --- a/libedataserver/e-gdbus-templates.c +++ b/libedataserver/e-gdbus-templates.c @@ -1014,7 +1014,9 @@ e_gdbus_op_cancelled_cb (GCancellable *cancellable, cd->op_data = op_data; /* do this on idle, because this callback should be left - * as soon as possible, with no sync calls being done */ + * as soon as possible, with no sync calls being done; + * also schedule with priority higher than gtk+ uses + * for animations (check docs for G_PRIORITY_HIGH_IDLE) */ op_data->cancel_idle_id = g_idle_add_full (G_PRIORITY_DEFAULT, e_gdbus_op_cancelled_idle_cb, cd, cancel_data_free); } -- cgit v0.9.0.2