summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/threadimpl.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-07-07 16:41:03 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-07-08 16:30:47 +0200
commit835b88b883fa7c46a6a164612468f2c81af6cd69 (patch)
tree931ad8fda985a98b8026e62a13ecad733090b52a /cpukit/score/include/rtems/score/threadimpl.h
parentscore: Fix warning (diff)
downloadrtems-835b88b883fa7c46a6a164612468f2c81af6cd69.tar.bz2
score: Rename _Scheduler_SMP_Update_heir()
Rename and move _Scheduler_SMP_Update_heir() to _Thread_Dispatch_update_heir() since this function is not scheduler specific.
Diffstat (limited to 'cpukit/score/include/rtems/score/threadimpl.h')
-rw-r--r--cpukit/score/include/rtems/score/threadimpl.h34
1 files changed, 32 insertions, 2 deletions
diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
index b602b342de..4971e9d274 100644
--- a/cpukit/score/include/rtems/score/threadimpl.h
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -635,7 +635,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Signal_notification( Thread_Control *thread )
* @return The heir thread.
*
* @see _Thread_Dispatch(), _Thread_Start_multitasking() and
- * _Scheduler_SMP_Update_heir().
+ * _Thread_Dispatch_update_heir().
*/
RTEMS_INLINE_ROUTINE Thread_Control *_Thread_Get_heir_and_make_it_executing(
Per_CPU_Control *cpu_self
@@ -649,7 +649,7 @@ RTEMS_INLINE_ROUTINE Thread_Control *_Thread_Get_heir_and_make_it_executing(
/*
* It is critical that we first update the dispatch necessary and then the
* read the heir so that we don't miss an update by
- * _Scheduler_SMP_Update_heir().
+ * _Thread_Dispatch_update_heir().
*/
_Atomic_Fence( ATOMIC_ORDER_SEQ_CST );
#endif
@@ -660,6 +660,36 @@ RTEMS_INLINE_ROUTINE Thread_Control *_Thread_Get_heir_and_make_it_executing(
return heir;
}
+#if defined( RTEMS_SMP )
+RTEMS_INLINE_ROUTINE void _Thread_Dispatch_update_heir(
+ Per_CPU_Control *cpu_self,
+ Per_CPU_Control *cpu_for_heir,
+ Thread_Control *heir
+)
+{
+ cpu_for_heir->heir = heir;
+
+ /*
+ * It is critical that we first update the heir and then the dispatch
+ * necessary so that _Thread_Get_heir_and_make_it_executing() cannot miss an
+ * update.
+ */
+ _Atomic_Fence( ATOMIC_ORDER_SEQ_CST );
+
+ /*
+ * Only update the dispatch necessary indicator if not already set to
+ * avoid superfluous inter-processor interrupts.
+ */
+ if ( !cpu_for_heir->dispatch_necessary ) {
+ cpu_for_heir->dispatch_necessary = true;
+
+ if ( cpu_for_heir != cpu_self ) {
+ _Per_CPU_Send_interrupt( cpu_for_heir );
+ }
+ }
+}
+#endif
+
RTEMS_INLINE_ROUTINE void _Thread_Update_cpu_time_used(
Thread_Control *executing,
Timestamp_Control *time_of_last_context_switch