From 7dc587e2df96d5ef2575c945f9fdf784fe201a7e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 24 Mar 2023 14:53:07 +0100 Subject: [PATCH] some bugfixes --- linux/csp/CspComIF.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/linux/csp/CspComIF.cpp b/linux/csp/CspComIF.cpp index 919bf983..554ecba0 100644 --- a/linux/csp/CspComIF.cpp +++ b/linux/csp/CspComIF.cpp @@ -354,6 +354,11 @@ ReturnValue_t CspComIF::startRouterTask() { pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + res = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + if (res != 0) { + return returnvalue::FAILED; + } + // Set scheduling policy to SCHED_RR res = pthread_attr_setschedpolicy(&attr, SCHED_RR); if (res) { @@ -369,17 +374,18 @@ ReturnValue_t CspComIF::startRouterTask() { return returnvalue::FAILED; } - res = pthread_setname_np(pthread_self(), routerTaskName); + res = pthread_create(&routerTaskHandle, &attr, routerWorkWrapper, NULL); if (res) { pthread_attr_destroy(&attr); return returnvalue::FAILED; } - res = pthread_create(&routerTaskHandle, &attr, routerWorkWrapper, NULL); - pthread_attr_destroy(&attr); + res = pthread_setname_np(routerTaskHandle, routerTaskName); if (res) { + pthread_attr_destroy(&attr); return returnvalue::FAILED; } + pthread_attr_destroy(&attr); return returnvalue::OK; }