[PATCH v2] score: PR788: Add INTERNAL_ERROR_RESOURCE_IN_USE

Chris Johns chrisj at rtems.org
Thu Apr 3 01:22:57 UTC 2014


On 31/03/2014 10:51 pm, Sebastian Huber wrote:
> Issue a fatal error in case a thread is deleted which still owns
> resources (e.g. a binary semaphore with priority inheritance or ceiling
> protocol).  The resource count must be checked quite late since RTEMS
> task variable destructors, POSIX key destructors, POSIX cleanup handler,
> the Newlib thread termination extension or other thread termination
> extensions may release resources.  In this context it would be quite
> difficult to return an error status to the caller.
>
> An alternative would be to place threads with a non-zero resource count
> not on the zombie chain.  Thus we have a resource leak instead of a
> fatal error.  The terminator thread can see this error if we return an
> RTEMS_RESOURCE_IN_USE status for the rtems_task_delete() for example.

I think the fatal error approach is fine. Having a zombie thread and no 
code in the application to check for the state is much worse.

Chris



More information about the users mailing list