could task dispatching be enabled in libc_delete_hook() ?

Chris Johns chrisj at rtems.org
Thu Nov 11 21:58:34 UTC 2004


Till Straumann wrote:
> 
> I came across a problem (PR#716) which could be solved easily
> if task dispatching could temporarily be enabled in the libc_delete_hook().
> 
> Could you please give an analysis whether this would be safe?
> 

I would say no. The delete call is provided with the current thread and 
if you enable dispatching will current be current when you get back 
control and disable dispatching. Sure you could look at 
_Thread_Executing but this is a bit of a hack.

Another issue is the extensions list order is not controlled so an API 
may have deleted its user or API extension and another thread may try to 
do something with the thread via an API.

> 
> PS: I believe 716 exists independent of my modifications, it just
> is less obvious (since it would only appear if a task with a unflushed
> stream other than stdout/stderr is deleted).
> 

I see the need to make sure all memory allocated to a task is released 
when the task is closed, and maybe flushing buffers (but no convinced) 
but closing open files seems to be mixing a process model with a thread 
model.

-- 
  Chris Johns



More information about the users mailing list