From: Donald Sharp Date: Wed, 29 Nov 2017 19:26:44 +0000 (-0500) Subject: lib: Fix thread removal from a pqueue X-Git-Tag: frr-4.0-dev~121^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=522f7f992384dc9273a9cbf88cfec1ebccdf4866;p=matthieu%2Ffrr.git 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 --- 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) {