initAfterTaskCreation added for linux
This commit is contained in:
parent
4530b19548
commit
381914886d
@ -46,27 +46,33 @@ ReturnValue_t PeriodicPosixTask::startTask(void){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PeriodicPosixTask::taskFunctionality(void){
|
void PeriodicPosixTask::taskFunctionality(void){
|
||||||
if(!started){
|
if(not started){
|
||||||
suspend();
|
suspend();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (auto const &object: objectList) {
|
||||||
|
object->initializeAfterTaskCreation();
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t lastWakeTime = getCurrentMonotonicTimeMs();
|
uint64_t lastWakeTime = getCurrentMonotonicTimeMs();
|
||||||
//The task's "infinite" inner loop is entered.
|
//The task's "infinite" inner loop is entered.
|
||||||
while (1) {
|
while (1) {
|
||||||
for (ObjectList::iterator it = objectList.begin();
|
for (auto const &object: objectList) {
|
||||||
it != objectList.end(); ++it) {
|
object->performOperation();
|
||||||
(*it)->performOperation();
|
|
||||||
}
|
}
|
||||||
if(!PosixThread::delayUntil(&lastWakeTime,periodMs)){
|
|
||||||
|
if(not PosixThread::delayUntil(&lastWakeTime, periodMs)){
|
||||||
char name[20] = {0};
|
char name[20] = {0};
|
||||||
int status = pthread_getname_np(pthread_self(),name,sizeof(name));
|
int status = pthread_getname_np(pthread_self(), name, sizeof(name));
|
||||||
if(status==0){
|
if(status == 0) {
|
||||||
sif::error << "PeriodicPosixTask " << name << ": Deadline "
|
sif::error << "PeriodicPosixTask " << name << ": Deadline "
|
||||||
"missed." << std::endl;
|
"missed." << std::endl;
|
||||||
}else{
|
}
|
||||||
|
else {
|
||||||
sif::error << "PeriodicPosixTask X: Deadline missed. " <<
|
sif::error << "PeriodicPosixTask X: Deadline missed. " <<
|
||||||
status << std::endl;
|
status << std::endl;
|
||||||
}
|
}
|
||||||
if (this->deadlineMissedFunc != NULL) {
|
if (this->deadlineMissedFunc != nullptr) {
|
||||||
this->deadlineMissedFunc();
|
this->deadlineMissedFunc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user