]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: Fix thread removal from a pqueue
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 29 Nov 2017 19:26:44 +0000 (14:26 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 29 Nov 2017 19:53:59 +0000 (14:53 -0500)
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 <sharpd@cumulusnetworks.com>
lib/thread.c

index cb5d1d47ae23b48c66c1b5762be80d8aa4bb551c..d26db8855029a2c2346044621f32396987016d2f 100644 (file)
@@ -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) {