Allow creating regular threads #140
@ -178,20 +178,32 @@ void PosixThread::createTask(void* (*fnc_)(void*), void* arg_) {
|
|||||||
#ifndef FSFW_USE_REALTIME_FOR_LINUX
|
#ifndef FSFW_USE_REALTIME_FOR_LINUX
|
||||||
#error "Please define FSFW_USE_REALTIME_FOR_LINUX with either 0 or 1"
|
#error "Please define FSFW_USE_REALTIME_FOR_LINUX with either 0 or 1"
|
||||||
#endif
|
#endif
|
||||||
#if FSFW_USE_REALTIME_FOR_LINUX == 1
|
if (priority < 100) {
|
||||||
// RR -> This needs root privileges for the process
|
// RR -> This needs root privileges for the process
|
||||||
|
#if FSFW_USE_REALTIME_FOR_LINUX == 1
|
||||||
status = pthread_attr_setschedpolicy(&attributes, SCHED_RR);
|
status = pthread_attr_setschedpolicy(&attributes, SCHED_RR);
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
utility::printUnixErrorGeneric(CLASS_NAME, "createTask", "pthread_attr_setschedpolicy");
|
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;
|
sched_param scheduleParams;
|
||||||
scheduleParams.__sched_priority = priority;
|
scheduleParams.__sched_priority = priority;
|
||||||
status = pthread_attr_setschedparam(&attributes, &scheduleParams);
|
status = pthread_attr_setschedparam(&attributes, &scheduleParams);
|
||||||
if (status != 0) {
|
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
|
#endif
|
||||||
|
}
|
||||||
// Set Signal Mask for suspend until startTask is called
|
// Set Signal Mask for suspend until startTask is called
|
||||||
sigset_t waitSignal;
|
sigset_t waitSignal;
|
||||||
sigemptyset(&waitSignal);
|
sigemptyset(&waitSignal);
|
||||||
|
Loading…
Reference in New Issue
Block a user