Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Os::Task::taskRoutine not compliant with POSIX Thread Entrypoint #661

Closed
Joshua-Anderson opened this issue Jun 1, 2021 · 0 comments · Fixed by #700
Closed

Os::Task::taskRoutine not compliant with POSIX Thread Entrypoint #661

Joshua-Anderson opened this issue Jun 1, 2021 · 0 comments · Fixed by #700
Labels

Comments

@Joshua-Anderson
Copy link
Contributor

F´ Version devel
Affected Component Os

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:

/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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
@Joshua-Anderson and others