From 822459f1bb0d004dacee735e35ff6aa94e74ddc9 Mon Sep 17 00:00:00 2001 From: Tomas Sanchez Date: Fri, 22 Apr 2022 11:38:07 -0300 Subject: [PATCH] perf(lib): optimize thread_manager_end thread() --- lib/src/util/thread_manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/util/thread_manager.c b/lib/src/util/thread_manager.c index c5304d6..7087acc 100644 --- a/lib/src/util/thread_manager.c +++ b/lib/src/util/thread_manager.c @@ -162,7 +162,7 @@ int thread_manager_end_thread(thread_manager_t *tm) return EXIT_FAILURE; // Move the last positition to the deleted one. - if (tm->size > 0) + if (tm->size > 1) tm->threads[t_id] = tm->threads[tm->size - 1]; tm->size--;