EIVE upstream #29
@ -178,20 +178,32 @@ void PosixThread::createTask(void* (*fnc_)(void*), void* arg_) {
|
||||
#ifndef FSFW_USE_REALTIME_FOR_LINUX
|
||||
#error "Please define FSFW_USE_REALTIME_FOR_LINUX with either 0 or 1"
|
||||
#endif
|
||||
if (priority < 100) {
|
||||
// RR -> This needs root privileges for the process
|
||||
#if FSFW_USE_REALTIME_FOR_LINUX == 1
|
||||
// RR -> This needs root privileges for the process
|
||||
status = pthread_attr_setschedpolicy(&attributes, SCHED_RR);
|
||||
if (status != 0) {
|
||||
utility::printUnixErrorGeneric(CLASS_NAME, "createTask", "pthread_attr_setschedpolicy");
|
||||
status = pthread_attr_setschedpolicy(&attributes, SCHED_RR);
|
||||
if (status != 0) {
|
||||
utility::printUnixErrorGeneric(CLASS_NAME, "createTask", "pthread_attr_setschedpolicy");
|
||||
}
|
||||
#else
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning
|
||||
<< "Real time priorities are only allowed if FSFW_USE_REALTIME_FOR_LINUX is set to 1"
|
||||
<< std::endl;
|
||||
#endif
|
||||
#endif
|
||||
} else {
|
||||
priority = 0;
|
||||
}
|
||||
|
||||
sched_param scheduleParams;
|
||||
scheduleParams.__sched_priority = priority;
|
||||
status = pthread_attr_setschedparam(&attributes, &scheduleParams);
|
||||
if (status != 0) {
|
||||
utility::printUnixErrorGeneric(CLASS_NAME, "createTask", "pthread_attr_setschedparam");
|
||||
}
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "PosixThread: Setting priority failed" << std::endl;
|
||||
#endif
|
||||
}
|
||||
// Set Signal Mask for suspend until startTask is called
|
||||
sigset_t waitSignal;
|
||||
sigemptyset(&waitSignal);
|
||||
|
Loading…
Reference in New Issue
Block a user