[glib] GTask: Avoid resorting
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] GTask: Avoid resorting
- Date: Mon, 29 Jun 2015 15:21:30 +0000 (UTC)
commit e419e1c4e212b1195c8e531fd6eeb4a0b80108d3
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Jun 18 10:36:23 2015 -0400
GTask: Avoid resorting
When a task is cancelled, we want to move it to the front
of the queue - our sort function does that for us, but there
is no need to resort the entire queue here, we can just
move the one item and be done with it. This uses just-introduced
threadpool api for this purpose.
https://bugzilla.gnome.org/show_bug.cgi?id=751160
gio/gtask.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/gio/gtask.c b/gio/gtask.c
index 2bf82a2..c2569dc 100644
--- a/gio/gtask.c
+++ b/gio/gtask.c
@@ -1296,7 +1296,10 @@ task_thread_cancelled (GCancellable *cancellable,
{
GTask *task = user_data;
- g_task_thread_pool_resort ();
+ /* Move this task to the front of the queue - no need for
+ * a complete resorting of the queue.
+ */
+ g_thread_pool_move_to_front (task_pool, task);
g_mutex_lock (&task->lock);
task->thread_cancelled = TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]