implemented deadlien missed print for host
This commit is contained in:
@ -10,6 +10,7 @@
|
||||
|
||||
#if defined(WIN32)
|
||||
#include <processthreadsapi.h>
|
||||
#include <fsfw/osal/windows/winTaskHelpers.h>
|
||||
#elif defined(LINUX)
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
@ -22,33 +23,11 @@ PeriodicTask::PeriodicTask(const char *name, TaskPriority setPriority,
|
||||
// It is propably possible to set task priorities by using the native
|
||||
// task handles for Windows / Linux
|
||||
mainThread = std::thread(&PeriodicTask::taskEntryPoint, this, this);
|
||||
#if defined(WIN32)
|
||||
/* List of possible priority classes:
|
||||
* https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/
|
||||
* nf-processthreadsapi-setpriorityclass
|
||||
* And respective thread priority numbers:
|
||||
* https://docs.microsoft.com/en-us/windows/
|
||||
* win32/procthread/scheduling-priorities */
|
||||
int result = SetPriorityClass(
|
||||
reinterpret_cast<HANDLE>(mainThread.native_handle()),
|
||||
ABOVE_NORMAL_PRIORITY_CLASS);
|
||||
if(result != 0) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "PeriodicTask: Windows SetPriorityClass failed with code "
|
||||
<< GetLastError() << std::endl;
|
||||
#endif
|
||||
}
|
||||
result = SetThreadPriority(
|
||||
reinterpret_cast<HANDLE>(mainThread.native_handle()),
|
||||
THREAD_PRIORITY_NORMAL);
|
||||
if(result != 0) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "PeriodicTask: Windows SetPriorityClass failed with code "
|
||||
<< GetLastError() << std::endl;
|
||||
#endif
|
||||
}
|
||||
#elif defined(LINUX)
|
||||
// we can just copy and paste the code from linux here.
|
||||
#if defined(_WIN32)
|
||||
tasks::setTaskPriority(reinterpret_cast<HANDLE>(mainThread.native_handle()), setPriority);
|
||||
tasks::insertTaskName(mainThread.get_id(), taskName);
|
||||
#elif defined(__unix__)
|
||||
// TODO: We could reuse existing code here.
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user