diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-11-29 14:26:44 -0500 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-11-29 14:53:59 -0500 |
| commit | 522f7f992384dc9273a9cbf88cfec1ebccdf4866 (patch) | |
| tree | 4bd19f4f3ece4ad7195c3c0b69da47563e1f94ab | |
| parent | 69df82f3b5d3aa343c769f280fb811ce019601d4 (diff) | |
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>
| -rw-r--r-- | lib/thread.c | 3 |
1 files changed, 2 insertions, 1 deletions
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) { |
