summaryrefslogtreecommitdiffstats
path: root/lib/thread.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-11-29 20:26:44 +0100
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-11-29 20:53:59 +0100
commit522f7f992384dc9273a9cbf88cfec1ebccdf4866 (patch)
tree4bd19f4f3ece4ad7195c3c0b69da47563e1f94ab /lib/thread.c
parentMerge pull request #1493 from donaldsharp/plist_stuff (diff)
downloadfrr-522f7f992384dc9273a9cbf88cfec1ebccdf4866.tar.xz
frr-522f7f992384dc9273a9cbf88cfec1ebccdf4866.zip
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 <sharpd@cumulusnetworks.com>
Diffstat (limited to 'lib/thread.c')
-rw-r--r--lib/thread.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/thread.c b/lib/thread.c
index cb5d1d47a..d26db8855 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) {