1
0
forked from fsfw/fsfw

platform header file

This commit is contained in:
2021-05-12 16:47:53 +02:00
parent d27f49c968
commit 1626b266d7
10 changed files with 42 additions and 48 deletions

View File

@ -1,10 +1,12 @@
#include "../../serviceinterface/ServiceInterface.h"
#include "../../timemanager/Clock.h"
#include "../../platform.h"
#include <chrono>
#if defined(_WIN32)
#if defined(PLATFORM_WIN)
#include <sysinfoapi.h>
#elif defined(__unix__)
#elif defined(PLATFORM_UNIX)
#include <fstream>
#endif

View File

@ -1,4 +1,5 @@
#include "taskHelpers.h"
#include "../../platform.h"
#include "../../osal/host/FixedTimeslotTask.h"
#include "../../ipc/MutexFactory.h"
#include "../../osal/host/Mutex.h"
@ -9,10 +10,10 @@
#include <thread>
#include <chrono>
#if defined(WIN32)
#if defined(PLATFORM_WIN)
#include <windows.h>
#include "../windows/winTaskHelpers.h"
#elif defined(LINUX)
#elif defined(PLATFORM_UNIX)
#include <pthread.h>
#endif

View File

@ -2,6 +2,7 @@
#include "PeriodicTask.h"
#include "taskHelpers.h"
#include "../../platform.h"
#include "../../ipc/MutexFactory.h"
#include "../../serviceinterface/ServiceInterfaceStream.h"
#include "../../tasks/ExecutableObjectIF.h"
@ -9,10 +10,10 @@
#include <thread>
#include <chrono>
#if defined(WIN32)
#if defined(PLATFORM_WIN)
#include <processthreadsapi.h>
#include <fsfw/osal/windows/winTaskHelpers.h>
#elif defined(__unix__)
#elif defined(PLATFORM_UNIX)
#include <pthread.h>
#endif
@ -24,9 +25,9 @@ PeriodicTask::PeriodicTask(const char *name, TaskPriority setPriority,
// It is probably possible to set task priorities by using the native
// task handles for Windows / Linux
mainThread = std::thread(&PeriodicTask::taskEntryPoint, this, this);
#if defined(_WIN32)
#if defined(PLATFORM_WIN)
tasks::setTaskPriority(reinterpret_cast<HANDLE>(mainThread.native_handle()), setPriority);
#elif defined(__unix__)
#elif defined(PLATFORM_UNIX)
// TODO: We could reuse existing code here.
#endif
tasks::insertTaskName(mainThread.get_id(), taskName);