You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
F Prime's threads have no return value, which was likely done to provide greater compatibility across different platforms.
However, POSIX threads are expected to return a void *. This causes compilation errors, since returning void when a return value is expected is undefined behavior.
We should either wrap the user provided taskRoutine with another function that returns 0 or change taskRoutine to expect a return value.
From compiling with -Wextra:
/fprime/Os/Posix/Task.cpp: In member function ‘Os::Task::TaskStatus Os::Task::start(const Fw::StringBase&, NATIVE_INT_TYPE, NATIVE_INT_TYPE, NATIVE_INT_TYPE, Os::Task::taskRoutine, void*, NATIVE_INT_TYPE)’:
/fprime/Os/Posix/Task.cpp:119:58: error: cast between incompatible function types from ‘Os::Task::taskRoutine’ {aka ‘void (*)(void*)’} to ‘pthread_func_ptr’ {aka ‘void* (*)(void*)’} [-Werror=cast-function-type]
119 | stat = pthread_create(tid,&att,(pthread_func_ptr)routine,arg);
The text was updated successfully, but these errors were encountered:
Problem Description
F Prime's threads have no return value, which was likely done to provide greater compatibility across different platforms.
However, POSIX threads are expected to return a
void *
. This causes compilation errors, since returning void when a return value is expected is undefined behavior.We should either wrap the user provided taskRoutine with another function that returns 0 or change taskRoutine to expect a return value.
From compiling with
-Wextra
:The text was updated successfully, but these errors were encountered: