summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/taskvariable_invoke_dtor.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-12-12 23:19:57 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-12-12 23:19:57 +0000
commit98dee44ba89670de7a9eb9e2e36d187cc55546b8 (patch)
tree9c64b8185d2f5e75cb50506c5cfbfee6107bd1f7 /cpukit/rtems/src/taskvariable_invoke_dtor.c
parent2007-12-12 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-98dee44ba89670de7a9eb9e2e36d187cc55546b8.tar.bz2
2007-12-12 Joel Sherrill <joel.sherrill@OARcorp.com>
* rtems/Makefile.am, rtems/include/rtems/rtems/tasks.h, rtems/src/tasks.c, rtems/src/taskvariableadd.c, rtems/src/taskvariabledelete.c: Add test code for task variables to improve coverage. * rtems/src/taskvariable_invoke_dtor.c: New file.
Diffstat (limited to 'cpukit/rtems/src/taskvariable_invoke_dtor.c')
-rw-r--r--cpukit/rtems/src/taskvariable_invoke_dtor.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/cpukit/rtems/src/taskvariable_invoke_dtor.c b/cpukit/rtems/src/taskvariable_invoke_dtor.c
new file mode 100644
index 0000000000..d348c6d90e
--- /dev/null
+++ b/cpukit/rtems/src/taskvariable_invoke_dtor.c
@@ -0,0 +1,43 @@
+/*
+ * Invoke the destructor on a per-task variable
+ *
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/score/wkspace.h>
+
+void _RTEMS_Tasks_Invoke_task_variable_dtor(
+ Thread_Control *the_thread,
+ rtems_task_variable_t *tvp
+)
+{
+ void (*dtor)(void *);
+ void *value;
+
+ dtor = tvp->dtor;
+ if (_Thread_Is_executing(the_thread)) {
+ value = *tvp->ptr;
+ *tvp->ptr = tvp->gval;
+ } else {
+ value = tvp->tval;
+ }
+
+ if ( dtor )
+ (*dtor)(value);
+
+ _Workspace_Free(tvp);
+}