Commit e419e1c4 authored by Matthias Clasen's avatar Matthias Clasen

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
parent 9486f697
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment