From f63f06da2e7be6b17c72dd6110aae179f42f3700 Mon Sep 17 00:00:00 2001 From: Paul Jakma Date: Fri, 8 Apr 2011 12:44:43 +0100 Subject: general: remove inline qualifiers and move in-header functions to objects * (general) Move functions in headers into files, to be compiled into shared object files. Remove inline qualifier from functions. Let the compiler do the work. --- lib/thread.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/thread.c') diff --git a/lib/thread.c b/lib/thread.c index fd841c21..6d3c3cb3 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -248,7 +248,7 @@ cpu_record_hash_free (void *a) XFREE (MTYPE_THREAD_STATS, hist); } -static inline void +static void vty_out_cpu_thread_history(struct vty* vty, struct cpu_thread_history *a) { @@ -608,7 +608,7 @@ thread_master_free (struct thread_master *m) } /* Thread list is empty or not. */ -static inline int +static int thread_empty (struct thread_list *list) { return list->head ? 0 : 1; -- cgit v1.2.3 From b5043aabb03567b46a16463d88a8afce2acda35e Mon Sep 17 00:00:00 2001 From: Paul Jakma Date: Tue, 28 Feb 2012 18:32:56 +0000 Subject: lib: fix incorrect thread list processing loops * thread.c: (thread_timer_process,thread_process) thread_list_delete nulls thread->next. Loops need to save next first, or will only process the head. Problem noted by Lou Berger . --- lib/thread.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/thread.c') diff --git a/lib/thread.c b/lib/thread.c index 6d3c3cb3..b36c43a9 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -972,10 +972,12 @@ static unsigned int thread_timer_process (struct thread_list *list, struct timeval *timenow) { struct thread *thread; + struct thread *next; unsigned int ready = 0; - for (thread = list->head; thread; thread = thread->next) + for (thread = list->head; thread; thread = next) { + next = thread->next; if (timeval_cmp (*timenow, thread->u.sands) < 0) return ready; thread_list_delete (list, thread); @@ -991,10 +993,12 @@ static unsigned int thread_process (struct thread_list *list) { struct thread *thread; + struct thread *next; unsigned int ready = 0; - for (thread = list->head; thread; thread = thread->next) + for (thread = list->head; thread; thread = next) { + next = thread->next; thread_list_delete (list, thread); thread->type = THREAD_READY; thread_list_add (&thread->master->ready, thread); -- cgit v1.2.3