From 8ad30d489a35cdd6ee27c2e14cfd907d85b62ee0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 2 Dec 2020 00:58:13 +0100 Subject: [PATCH] important bugfix for host osal --- osal/host/PeriodicTask.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osal/host/PeriodicTask.cpp b/osal/host/PeriodicTask.cpp index f4ee079b1..fb2369637 100644 --- a/osal/host/PeriodicTask.cpp +++ b/osal/host/PeriodicTask.cpp @@ -89,6 +89,10 @@ ReturnValue_t PeriodicTask::sleepFor(uint32_t ms) { } void PeriodicTask::taskFunctionality() { + for (const auto& object: objectList) { + object->initializeAfterTaskCreation(); + } + std::chrono::milliseconds periodChrono(static_cast(period*1000)); auto currentStartTime { std::chrono::duration_cast( @@ -101,9 +105,8 @@ void PeriodicTask::taskFunctionality() { if(terminateThread.load()) { break; } - for (ObjectList::iterator it = objectList.begin(); - it != objectList.end(); ++it) { - (*it)->performOperation(); + for (const auto& object: objectList) { + object->performOperation(); } if(not delayForInterval(¤tStartTime, periodChrono)) { sif::warning << "PeriodicTask: " << taskName <<