initAfterTaskCreation added for linux

This commit is contained in:
Robin Müller 2020-09-04 14:43:53 +02:00
parent 4530b19548
commit 381914886d

View File

@ -46,27 +46,33 @@ ReturnValue_t PeriodicPosixTask::startTask(void){
}
void PeriodicPosixTask::taskFunctionality(void){
if(!started){
if(not started){
suspend();
}
for (auto const &object: objectList) {
object->initializeAfterTaskCreation();
}
uint64_t lastWakeTime = getCurrentMonotonicTimeMs();
//The task's "infinite" inner loop is entered.
while (1) {
for (ObjectList::iterator it = objectList.begin();
it != objectList.end(); ++it) {
(*it)->performOperation();
for (auto const &object: objectList) {
object->performOperation();
}
if(!PosixThread::delayUntil(&lastWakeTime,periodMs)){
if(not PosixThread::delayUntil(&lastWakeTime, periodMs)){
char name[20] = {0};
int status = pthread_getname_np(pthread_self(),name,sizeof(name));
if(status==0){
int status = pthread_getname_np(pthread_self(), name, sizeof(name));
if(status == 0) {
sif::error << "PeriodicPosixTask " << name << ": Deadline "
"missed." << std::endl;
}else{
}
else {
sif::error << "PeriodicPosixTask X: Deadline missed. " <<
status << std::endl;
}
if (this->deadlineMissedFunc != NULL) {
if (this->deadlineMissedFunc != nullptr) {
this->deadlineMissedFunc();
}
}