Pthread_cancel API

Hi, I am trying to carry an application to freeRTOS from Linux. However, the application is using pthread_cancel which is not supported in freeRTOS. My question is that what can I do to replace this API? I tried pthread_exit, but it is only used in the thread itself, but I need to use the API in the main function as in the case of pthread_cancel. Thank you in advance.

Better show the code sequence and where it is called and why.
Since there is no support for synchronous task cancellation you’ve create your own ‘cancel’ signaling. Async thread cancellation is evil anyway :wink:
And do you already know the comprehensive documentation ?

and there

FreeRTOS doesn’t support the complexity of a bigger type of OS, so sometimes you can’t just “port” an application from such a system to FreeRTOS. You have to ask yourself, WHY was I using pthread_cancel, and then you can decide how to do something like that under FreeRTOS.

1 Like