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 <felix.walter@d3tn.com>
This commit is contained in:
Felix Walter 2023-12-20 10:14:52 +01:00
parent 60645f1286
commit 9fc5f753b4

View file

@ -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, &param)) {
/* 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;