From d89047659c36fe49ee5ef6837210ac5a84682453 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Tue, 21 Sep 2021 00:00:00 -0500 Subject: [PATCH] top: modify semaphore destruction for separate threads This commit just ensures that at program end all those semaphores are removed in the same order for symmetry. From thread's view of importance, we do least to most. Signed-off-by: Jim Warner --- top/top.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/top/top.c b/top/top.c index 6348ac9c..50e0a11a 100644 --- a/top/top.c +++ b/top/top.c @@ -439,14 +439,14 @@ static void bye_bye (const char *str) { #ifdef THREADED_CPU pthread_cancel(Thread_id_cpus); pthread_join(Thread_id_cpus, NULL); - sem_destroy(&Semaphore_cpus_beg); sem_destroy(&Semaphore_cpus_end); + sem_destroy(&Semaphore_cpus_beg); #endif #ifdef THREADED_MEM pthread_cancel(Thread_id_memory); pthread_join(Thread_id_memory, NULL); - sem_destroy(&Semaphore_memory_beg); sem_destroy(&Semaphore_memory_end); + sem_destroy(&Semaphore_memory_beg); #endif #ifdef THREADED_TSK pthread_cancel(Thread_id_tasks);