task variable DTOR (was Re: More heap corruption / allocator lock problems)

Till Straumann strauman at SLAC.Stanford.EDU
Thu Oct 16 22:51:33 UTC 2003


Joel.

I have been thinking about this for a while now. Unfortunately,
it seems to me that the whole implementation of the task variable dtor
is seriously flawed:

a) Currently, the task variable 'dtor' is run in the context of a
    user extension's 'TASK_DELETE' hook. However, the book says:

      "This extension should not call any RTEMS directives
       if a task is deleting itself (current_task is equal
       to deleted_task)."

b) The book also encourages the use of 'free' as or from a task
    variable dtor.

Note also

c) When using rtems_task_variable_delete(), the 'dtor' is *never*
    called.

I don't think any of our discussed fixes is a clean solution for this
mess. How about this:

I) Why does the 'dtor' have to be called from a user extension in the first
    place? How about destroying task variables from a (non dispatch-disabled
    section) of 'rtems_task_delete()' itself?

II) IMO, rtems_task_variable_delete() should execute the 'dtor'.

RFC

-- Till




More information about the users mailing list