From 9fc5f753b4c7f1d91d3094de5276765021566c63 Mon Sep 17 00:00:00 2001 From: Felix Walter Date: Wed, 20 Dec 2023 10:14:52 +0100 Subject: [PATCH] hal_task: Remove custom priorities and stack size We implemented this to mirror the behavior on STM32 with FreeRTOS. We do not need it anymore on POSIX systems, so better go with the defaults of the OS. Closes: #162 Signed-off-by: Felix Walter --- components/platform/posix/hal_task.c | 31 ---------------------------- 1 file changed, 31 deletions(-) diff --git a/components/platform/posix/hal_task.c b/components/platform/posix/hal_task.c index 12dabf3..5f0e483 100644 --- a/components/platform/posix/hal_task.c +++ b/components/platform/posix/hal_task.c @@ -7,11 +7,6 @@ * */ -/* enable linux features when linux OS */ -#if linux -#define _GNU_SOURCE -#endif - #include "ud3tn/common.h" #include "platform/hal_config.h" @@ -68,38 +63,12 @@ enum ud3tn_result hal_task_create( goto fail; } - /* set the scheduling policy */ - if (pthread_attr_setschedpolicy(&tattr, SCHED_RR)) { - /* abort if error occurs */ - LOG_ERROR("Setting the scheduling policy failed!"); - goto fail_attr; - } - /* Create thread in detached state, so that no cleanup is necessary */ if (pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED)) { LOG_ERROR("Setting detached state failed!"); goto fail_attr; } - /* set the scheduling priority (just use the absolute minimum and add */ - /* the given priority */ - param.sched_priority = sched_get_priority_min(SCHED_RR) + - task_priority; - if (pthread_attr_setschedparam(&tattr, ¶m)) { - /* abort if error occurs */ - LOG_ERROR("Setting the scheduling priority failed!"); - goto fail_attr; - } - - /* update the stack size of the thread (only if greater than 0, */ - /* otherwise set stack size to the default value */ - if (task_stack_size != 0 && - pthread_attr_setstacksize(&tattr, task_stack_size)) { - /* abort if error occurs */ - LOG_ERROR("Setting the tasks stack size failed! Wrong value!"); - goto fail_attr; - } - desc->task_function = task_function; desc->task_parameter = task_parameters;