[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
could task dispatching be enabled in libc_delete_hook() ?
- Date: Thu, 11 Nov 2004 19:29:52 -0800
- From: strauman at slac.stanford.edu (Till Straumann)
- Subject: could task dispatching be enabled in libc_delete_hook() ?
Chris Johns wrote:
> Till Straumann wrote:
>> I came across a problem (PR#716) which could be solved easily
>> if task dispatching could temporarily be enabled in the
>> 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
Sure - I believe sharing files (among threads)
will come with future newlib versions. However,
in 1.11 it seems that FILE objects are maintained
per-thread :-( hence the need to clean them up...