diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 80df76caab..619e06c557 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,13 @@ +2005-10-04 Till Straumann + + PR 829/rtems + * rtems/src/tasks.c, rtems/src/taskvariabledelete.c: If task variables + are deleted from a different context (i.e., executing context != + owner of the task variable. The owner meaning the task that + registered the dtor in question) the argument passed to the task + variable dtor must be tvar and not *ptr which yields the executing + task's value of the task variable instead of the owner's. + 2005-09-29 Eric Norum * libmisc/cpuuse/cpuuse.c: Remove floating point calculations and the diff --git a/cpukit/rtems/src/tasks.c b/cpukit/rtems/src/tasks.c index bf2fdbb2ed..83c6b3928a 100644 --- a/cpukit/rtems/src/tasks.c +++ b/cpukit/rtems/src/tasks.c @@ -112,10 +112,14 @@ User_extensions_routine _RTEMS_tasks_Delete_extension( deleted->task_variables = NULL; while (tvp) { next = tvp->next; - if (tvp->dtor) + if (_Thread_Is_executing(deleted)) { + if (tvp->dtor) (*tvp->dtor)(*tvp->ptr); - if (_Thread_Is_executing(deleted)) - *tvp->ptr = tvp->gval; + *tvp->ptr = tvp->gval; + } else { + if (tvp->dtor) + (*tvp->dtor)(tvp->tval); + } _Workspace_Free( tvp ); tvp = next; } diff --git a/cpukit/rtems/src/taskvariabledelete.c b/cpukit/rtems/src/taskvariabledelete.c index 2e0ccd692d..e90b098ac7 100644 --- a/cpukit/rtems/src/taskvariabledelete.c +++ b/cpukit/rtems/src/taskvariabledelete.c @@ -60,10 +60,14 @@ rtems_status_code rtems_task_variable_delete( if (tvp->ptr == ptr) { if (prev) prev->next = tvp->next; else the_thread->task_variables = tvp->next; - if (tvp->dtor) - (*tvp->dtor)(*tvp->ptr); - if (_Thread_Is_executing(the_thread)) + if (_Thread_Is_executing(the_thread)) { + if (tvp->dtor) + (*tvp->dtor)(*tvp->ptr); *tvp->ptr = tvp->gval; + } else { + if (tvp->dtor) + (*tvp->dtor)(tvp->tval); + } _Workspace_Free(tvp); _Thread_Enable_dispatch(); return RTEMS_SUCCESSFUL;