[rtems commit] score: Add _Thread_Get_executing()
Sebastian Huber
sebh at rtems.org
Wed Jul 17 11:05:28 UTC 2013
Module: rtems
Branch: master
Commit: f74d9496ee4d0a8af72adbbda2e59d9b1d005423
Changeset: http://git.rtems.org/rtems/commit/?id=f74d9496ee4d0a8af72adbbda2e59d9b1d005423
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Wed Jul 17 11:03:02 2013 +0200
score: Add _Thread_Get_executing()
---
cpukit/score/include/rtems/score/thread.h | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h
index 13b7e75..5e8bc95 100644
--- a/cpukit/score/include/rtems/score/thread.h
+++ b/cpukit/score/include/rtems/score/thread.h
@@ -66,6 +66,7 @@ extern "C" {
#include <rtems/score/percpu.h>
#include <rtems/score/context.h>
#include <rtems/score/cpu.h>
+#include <rtems/score/isr.h>
#if defined(RTEMS_MULTIPROCESSING)
#include <rtems/score/mppkt.h>
#endif
@@ -882,6 +883,34 @@ void _Thread_blocking_operation_Cancel(
ISR_Level level
);
+/**
+ * @brief Returns the thread control block of the executing thread.
+ *
+ * This function can be called in any context. On SMP configurations
+ * interrupts are disabled to ensure that the processor index is used
+ * consistently.
+ *
+ * @return The thread control block of the executing thread.
+ */
+RTEMS_INLINE_ROUTINE Thread_Control *_Thread_Get_executing( void )
+{
+ Thread_Control *executing;
+
+ #if defined( RTEMS_SMP )
+ ISR_Level level;
+
+ _ISR_Disable( level );
+ #endif
+
+ executing = _Thread_Executing;
+
+ #if defined( RTEMS_SMP )
+ _ISR_Enable( level );
+ #endif
+
+ return executing;
+}
+
#ifndef __RTEMS_APPLICATION__
#include <rtems/score/thread.inl>
#endif
More information about the vc
mailing list