summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/tasks.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/rtems/src/tasks.c')
-rw-r--r--cpukit/rtems/src/tasks.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/cpukit/rtems/src/tasks.c b/cpukit/rtems/src/tasks.c
index b7eadbea8a..19f0fcfaa3 100644
--- a/cpukit/rtems/src/tasks.c
+++ b/cpukit/rtems/src/tasks.c
@@ -108,10 +108,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;
}