1
0
forked from fsfw/fsfw

name storage abstraction available for linux as well

This commit is contained in:
2021-03-23 14:40:30 +01:00
parent bdd9889718
commit d781c6fcec
7 changed files with 46 additions and 53 deletions

View File

@ -1,3 +1,4 @@
#include "taskHelpers.h"
#include "../../tasks/TaskFactory.h"
#include "../../osal/host/FixedTimeslotTask.h"
#include "../../osal/host/PeriodicTask.h"
@ -5,12 +6,6 @@
#include "../../tasks/PeriodicTaskIF.h"
#include "../../serviceinterface/ServiceInterface.h"
#ifdef _WIN32
#include "../windows/winTaskHelpers.h"
#endif
#include <chrono>
TaskFactory* TaskFactory::factoryInstance = new TaskFactory();
@ -56,33 +51,12 @@ ReturnValue_t TaskFactory::delayTask(uint32_t delayMs){
}
void TaskFactory::printMissedDeadline() {
#ifdef __unix__
char name[20] = {0};
int status = pthread_getname_np(pthread_self(), name, sizeof(name));
#if FSFW_CPP_OSTREAM_ENABLED == 1
if(status == 0) {
sif::warning << "TaskFactory::printMissedDeadline: " << name << "" << std::endl;
}
else {
sif::warning << "TaskFactory::printMissedDeadline: Unknown task name" << status <<
std::endl;
}
#else
if(status == 0) {
sif::printWarning("TaskFactory::printMissedDeadline: %s\n", name);
}
else {
sif::printWarning("TaskFactory::printMissedDeadline: Unknown task name\n", name);
}
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
#elif defined(_WIN32)
std::string name = tasks::getTaskName(std::this_thread::get_id());
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "TaskFactory::printMissedDeadline: " << name << std::endl;
#else
sif::printWarning("TaskFactory::printMissedDeadline: %s\n", name);
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
#endif /* defined(_WIN32) */
}