From e0dd35f0d5127f9604e22714947d76d0de435095 Mon Sep 17 00:00:00 2001 From: Bartosz Podrygajlo <bartosz.podrygajlo@openairinterface.org> Date: Fri, 4 Oct 2024 09:25:48 +0200 Subject: [PATCH] Use threadCreate to start task_manager threads. This fixes the issue where running without sudo would cause threads to not start. --- .../task_manager/thread_pool/task_manager.c | 24 ++----------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/common/utils/task_manager/thread_pool/task_manager.c b/common/utils/task_manager/thread_pool/task_manager.c index b88ac4f66a1..b3d5845bd57 100644 --- a/common/utils/task_manager/thread_pool/task_manager.c +++ b/common/utils/task_manager/thread_pool/task_manager.c @@ -42,6 +42,7 @@ #include <unistd.h> #include <ctype.h> // toupper +#include "system.h" // #define POLL_AND_SLEEP @@ -511,30 +512,9 @@ void init_ws_task_manager(ws_task_manager_t* man, int* core_id, size_t num_threa args->idx = i; args->man = man; args->core_id = core_id[i]; - - pthread_attr_t attr = {0}; - - int ret = pthread_attr_init(&attr); - DevAssert(ret == 0); - ret = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - DevAssert(ret == 0); - ret = pthread_attr_setschedpolicy(&attr, SCHED_RR); - DevAssert(ret == 0); - struct sched_param sparam = {0}; - sparam.sched_priority = 97; - ret = pthread_attr_setschedparam(&attr, &sparam); - - int rc = pthread_create(&man->t_arr[i], &attr, worker_thread, args); - if (rc != 0) { - printf("[TASK_MAN]: %s \n", strerror(rc)); - printf("[TASK_MAN]: Could not create the pthread with attributtes, trying without attributes\n"); - rc = pthread_create(&man->t_arr[i], NULL, worker_thread, args); - AssertFatal(rc == 0, "Error creating a thread"); - } - char name[64]; sprintf(name, "Tpool%ld_%d", i, core_id[i]); - pthread_setname_np(man->t_arr[i], name); + threadCreate(&man->t_arr[i], worker_thread, args, name, args->core_id, OAI_PRIORITY_RT_MAX); } // Syncronize thread pool threads. All the threads started -- GitLab