better missed deadline handling
This commit is contained in:
@ -8,14 +8,9 @@
|
||||
#include <array>
|
||||
#include <cstring>
|
||||
|
||||
bool TestTask::oneShotAction = true;
|
||||
MutexIF* TestTask::testLock = nullptr;
|
||||
|
||||
TestTask::TestTask(object_id_t objectId_):
|
||||
SystemObject(objectId_), testMode(testModes::A) {
|
||||
if(testLock == nullptr) {
|
||||
testLock = MutexFactory::instance()->createMutex();
|
||||
}
|
||||
IPCStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
|
||||
}
|
||||
|
||||
@ -24,19 +19,17 @@ TestTask::~TestTask() {
|
||||
|
||||
ReturnValue_t TestTask::performOperation(uint8_t operationCode) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
sif::info << "Hallo EIVE!" << std::endl;
|
||||
testLock ->lockMutex(MutexIF::TimeoutType::WAITING, 20);
|
||||
|
||||
if(oneShotAction) {
|
||||
// Add code here which should only be run once
|
||||
/* Add code here which should only be run once */
|
||||
performOneShotAction();
|
||||
oneShotAction = false;
|
||||
}
|
||||
testLock->unlockMutex();
|
||||
|
||||
// Add code here which should only be run once per performOperation
|
||||
/* Add code here which should only be run once per performOperation */
|
||||
performPeriodicAction();
|
||||
|
||||
// Add code here which should only be run on alternating cycles.
|
||||
/* Add code here which should only be run on alternating cycles. */
|
||||
if(testMode == testModes::A) {
|
||||
performActionA();
|
||||
testMode = testModes::B;
|
||||
@ -49,7 +42,7 @@ ReturnValue_t TestTask::performOperation(uint8_t operationCode) {
|
||||
}
|
||||
|
||||
ReturnValue_t TestTask::performOneShotAction() {
|
||||
// Everything here will only be performed once.
|
||||
/* Everything here will only be performed once. */
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
@ -61,12 +54,12 @@ ReturnValue_t TestTask::performPeriodicAction() {
|
||||
|
||||
ReturnValue_t TestTask::performActionA() {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
// Add periodically executed code here
|
||||
/* Add periodically executed code here */
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t TestTask::performActionB() {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
// Add periodically executed code here
|
||||
/* Add periodically executed code here */
|
||||
return result;
|
||||
}
|
||||
|
@ -48,8 +48,7 @@ protected:
|
||||
private:
|
||||
// Actually, to be really thread-safe, a mutex should be used as well
|
||||
// Let's keep it simple for now.
|
||||
static bool oneShotAction;
|
||||
static MutexIF* testLock;
|
||||
bool oneShotAction = true;
|
||||
StorageManagerIF* IPCStore;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user