From 522f7f992384dc9273a9cbf88cfec1ebccdf4866 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 29 Nov 2017 14:26:44 -0500 Subject: [PATCH] lib: Fix thread removal from a pqueue When we remove a thread from a pqueue, use the saved index to go to the correct spot immediately instead of having to search the whole queue for it. Signed-off-by: Donald Sharp --- lib/thread.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/thread.c b/lib/thread.c index cb5d1d47ae..d26db88550 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -1045,7 +1045,8 @@ static void do_thread_cancel(struct thread_master *master) if (queue) { assert(thread->index >= 0); - pqueue_remove(thread, queue); + assert(thread == queue->array[thread->index]); + pqueue_remove_at(thread->index, queue); } else if (list) { thread_list_delete(list, thread); } else if (thread_array) { -- 2.39.5