summaryrefslogtreecommitdiffstats
path: root/c/src/exec
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/exec')
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/tasks.h5
-rw-r--r--c/src/exec/rtems/src/tasks.c2
-rw-r--r--c/src/exec/rtems/src/taskvariableadd.c6
-rw-r--r--c/src/exec/rtems/src/taskvariabledelete.c2
-rw-r--r--c/src/exec/score/include/rtems/score/thread.h5
5 files changed, 13 insertions, 7 deletions
diff --git a/c/src/exec/rtems/include/rtems/rtems/tasks.h b/c/src/exec/rtems/include/rtems/rtems/tasks.h
index fa574bba8a..f9234e6e89 100644
--- a/c/src/exec/rtems/include/rtems/rtems/tasks.h
+++ b/c/src/exec/rtems/include/rtems/rtems/tasks.h
@@ -412,7 +412,8 @@ rtems_status_code rtems_task_is_suspended(
rtems_status_code rtems_task_variable_add(
rtems_id tid,
- int *ptr
+ void **ptr,
+ void (*dtor)(void *)
);
/*
@@ -423,7 +424,7 @@ rtems_status_code rtems_task_variable_add(
rtems_status_code rtems_task_variable_delete(
rtems_id tid,
- int *ptr
+ void **ptr
);
/*
diff --git a/c/src/exec/rtems/src/tasks.c b/c/src/exec/rtems/src/tasks.c
index bbd9ff0dd8..5fdff2db18 100644
--- a/c/src/exec/rtems/src/tasks.c
+++ b/c/src/exec/rtems/src/tasks.c
@@ -103,6 +103,8 @@ User_extensions_routine _RTEMS_tasks_Delete_extension(
deleted->task_variables = NULL;
while (tvp) {
next = tvp->next;
+ if (tvp->dtor)
+ (*tvp->dtor)( tvp->ptr );
_Workspace_Free( tvp );
tvp = next;
}
diff --git a/c/src/exec/rtems/src/taskvariableadd.c b/c/src/exec/rtems/src/taskvariableadd.c
index 4ba8b7b21b..0f1ae0895e 100644
--- a/c/src/exec/rtems/src/taskvariableadd.c
+++ b/c/src/exec/rtems/src/taskvariableadd.c
@@ -24,7 +24,8 @@
rtems_status_code rtems_task_variable_add(
rtems_id tid,
- int *ptr
+ void **ptr,
+ void (*dtor)(void *)
)
{
Thread_Control *the_thread;
@@ -54,6 +55,7 @@ rtems_status_code rtems_task_variable_add(
tvp = the_thread->task_variables;
while (tvp) {
if (tvp->ptr == ptr) {
+ tvp->dtor = dtor;
_Thread_Enable_dispatch();
return RTEMS_SUCCESSFUL;
}
@@ -72,6 +74,7 @@ rtems_status_code rtems_task_variable_add(
}
new->var = 0;
new->ptr = ptr;
+ new->dtor = dtor;
new->next = the_thread->task_variables;
the_thread->task_variables = new;
@@ -80,4 +83,3 @@ rtems_status_code rtems_task_variable_add(
}
return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
}
-
diff --git a/c/src/exec/rtems/src/taskvariabledelete.c b/c/src/exec/rtems/src/taskvariabledelete.c
index eddaf1903d..c760f9ba39 100644
--- a/c/src/exec/rtems/src/taskvariabledelete.c
+++ b/c/src/exec/rtems/src/taskvariabledelete.c
@@ -24,7 +24,7 @@
rtems_status_code rtems_task_variable_delete(
rtems_id tid,
- int *ptr
+ void **ptr
)
{
Thread_Control *the_thread;
diff --git a/c/src/exec/score/include/rtems/score/thread.h b/c/src/exec/score/include/rtems/score/thread.h
index 0e2802bbac..ec48864a9f 100644
--- a/c/src/exec/score/include/rtems/score/thread.h
+++ b/c/src/exec/score/include/rtems/score/thread.h
@@ -93,8 +93,9 @@ struct rtems_task_variable_tt;
struct rtems_task_variable_tt {
struct rtems_task_variable_tt *next;
- int *ptr;
- int var;
+ void **ptr;
+ void *var;
+ void (*dtor)(void *);
};
typedef struct rtems_task_variable_tt rtems_task_variable_t;