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 <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2021-09-21 00:00:00 -05:00 committed by Craig Small
parent 476327048c
commit d89047659c

View File

@ -439,14 +439,14 @@ static void bye_bye (const char *str) {
#ifdef THREADED_CPU #ifdef THREADED_CPU
pthread_cancel(Thread_id_cpus); pthread_cancel(Thread_id_cpus);
pthread_join(Thread_id_cpus, NULL); pthread_join(Thread_id_cpus, NULL);
sem_destroy(&Semaphore_cpus_beg);
sem_destroy(&Semaphore_cpus_end); sem_destroy(&Semaphore_cpus_end);
sem_destroy(&Semaphore_cpus_beg);
#endif #endif
#ifdef THREADED_MEM #ifdef THREADED_MEM
pthread_cancel(Thread_id_memory); pthread_cancel(Thread_id_memory);
pthread_join(Thread_id_memory, NULL); pthread_join(Thread_id_memory, NULL);
sem_destroy(&Semaphore_memory_beg);
sem_destroy(&Semaphore_memory_end); sem_destroy(&Semaphore_memory_end);
sem_destroy(&Semaphore_memory_beg);
#endif #endif
#ifdef THREADED_TSK #ifdef THREADED_TSK
pthread_cancel(Thread_id_tasks); pthread_cancel(Thread_id_tasks);