before submitting a bug I would like to discuss the following issue.
I am using GNU Tools for ARM Embedded Processors with the Newlib libray. I have also enabled the configUSE_NEWLIB_REENTRANT macro to support task concurrency. However during the task deletion (no so much realtime…) the _reent xNewLib_reent is simply freed with the TCB. As far as I know the _reent struct should be reclaimed by calling _reclaim_reent at first. However such call is missing in prvDeleteTCB( TCB_t *pxTCB ).
There should be
This is even more critical with the Newlib compiled with _REENT_SMALL.
There is a workaround to hook to portCLEAN_UP_TCB( pxTCB ) but the user needs to access pxTCB directly.
Thanks for pointing this out. Note the caveats about newlib support, in that it was added following user request, but I don’t use it myself, so am reliant on other to point these things out.
Hello,
thank you. It seems to be correct. However I am using newlib only 3 days so that some opinions from more skilled users than me would be valuable.
I appreciate the newlib support got into mainline. I would rather to open a discussion before first because there are some caveats I am not aware of. E.g. I read a nice article about the Newlib today and there is a suggestion:
When the thread terminates, you should clean up all stdio usage by
the thread and call of its own atexit handlers by calling (see “reent.c”):
_wrapup_reent(thread_state);
source: http://andrewsterian.com/424/Lecture17.pdf
Later on,
Assuming this function has been really only introduced for RTEMS,
and given that it’s not used in newlib nor in RTEMS, I just removed
it now, as you proposed.
source: https://sourceware.org/ml/newlib/2013/msg00372.html