summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-12-20 21:51:23 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-12-20 21:51:23 +0000
commit23a0607ef1a3f210734f79c72bebb6c595bb7e4e (patch)
tree9e65b2f1ee9e62a57f9839244daaa0d5102adb33 /cpukit/rtems
parent2007-12-20 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-23a0607ef1a3f210734f79c72bebb6c595bb7e4e.tar.bz2
2007-12-20 Joel Sherrill <joel.sherrill@oarcorp.com>
* rtems/Makefile.am, rtems/include/rtems/rtems/tasks.h: Add rtems_task_self() directive. * rtems/src/taskself.c: New file.
Diffstat (limited to 'cpukit/rtems')
-rw-r--r--cpukit/rtems/Makefile.am2
-rw-r--r--cpukit/rtems/include/rtems/rtems/tasks.h8
-rw-r--r--cpukit/rtems/src/taskself.c24
3 files changed, 33 insertions, 1 deletions
diff --git a/cpukit/rtems/Makefile.am b/cpukit/rtems/Makefile.am
index 2d4895fe8b..44e9a153e7 100644
--- a/cpukit/rtems/Makefile.am
+++ b/cpukit/rtems/Makefile.am
@@ -58,7 +58,7 @@ librtems_a_SOURCES = src/rtemsobjectgetname.c
librtems_a_SOURCES += src/tasks.c src/taskcreate.c src/taskdelete.c \
src/taskgetnote.c src/taskident.c src/taskinitusers.c \
src/taskissuspended.c src/taskmode.c src/taskrestart.c src/taskresume.c \
- src/tasksetnote.c src/tasksetpriority.c src/taskstart.c \
+ src/taskself.c src/tasksetnote.c src/tasksetpriority.c src/taskstart.c \
src/tasksuspend.c src/taskwakeafter.c src/taskwakewhen.c \
src/taskvariableadd.c src/taskvariabledelete.c src/taskvariableget.c \
src/taskvariable_invoke_dtor.c src/taskdata.c
diff --git a/cpukit/rtems/include/rtems/rtems/tasks.h b/cpukit/rtems/include/rtems/rtems/tasks.h
index 0da7906fe1..af579f87b5 100644
--- a/cpukit/rtems/include/rtems/rtems/tasks.h
+++ b/cpukit/rtems/include/rtems/rtems/tasks.h
@@ -437,6 +437,14 @@ rtems_status_code rtems_task_variable_delete(
);
/*
+ * rtems_task_self
+ *
+ * This directive returns the ID of the currently executing task.
+ */
+
+rtems_id rtems_task_self(void);
+
+/*
* _RTEMS_tasks_Initialize_user_tasks
*
* This routine creates and starts all configured user
diff --git a/cpukit/rtems/src/taskself.c b/cpukit/rtems/src/taskself.c
new file mode 100644
index 0000000000..e596c15c60
--- /dev/null
+++ b/cpukit/rtems/src/taskself.c
@@ -0,0 +1,24 @@
+/*
+ * RTEMS Task Manager - Get ID of Self
+ *
+ * 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>
+
+rtems_id rtems_task_self(void)
+{
+ return _Thread_Executing->Object.id;
+}