summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/rtems/src/taskmode.c5
-rw-r--r--cpukit/score/inline/rtems/score/thread.inl52
2 files changed, 27 insertions, 30 deletions
diff --git a/cpukit/rtems/src/taskmode.c b/cpukit/rtems/src/taskmode.c
index 66cf505f0c..7b3233e55e 100644
--- a/cpukit/rtems/src/taskmode.c
+++ b/cpukit/rtems/src/taskmode.c
@@ -100,10 +100,7 @@ rtems_status_code rtems_task_mode(
}
}
- if ( _System_state_Is_up( _System_state_Get() ) ) {
- if (_Thread_Evaluate_is_dispatch_needed( needs_asr_dispatching ) )
- _Thread_Dispatch();
- }
+ _Thread_Dispatch_if_necessary( executing, needs_asr_dispatching );
return RTEMS_SUCCESSFUL;
}
diff --git a/cpukit/score/inline/rtems/score/thread.inl b/cpukit/score/inline/rtems/score/thread.inl
index e6e192901d..4576dea79e 100644
--- a/cpukit/score/inline/rtems/score/thread.inl
+++ b/cpukit/score/inline/rtems/score/thread.inl
@@ -223,6 +223,32 @@ RTEMS_INLINE_ROUTINE uint32_t _Thread_Get_global_exit_status( void )
}
/**
+ * @brief Issues a thread dispatch if necessary.
+ *
+ * @param[in] executing The executing thread.
+ * @param[in] needs_asr_dispatching Indicates whether or not the API
+ * level signals are pending and a dispatch is necessary.
+ */
+RTEMS_INLINE_ROUTINE void _Thread_Dispatch_if_necessary(
+ Thread_Control *executing,
+ bool needs_asr_dispatching
+)
+{
+ if ( _Thread_Dispatch_is_enabled() ) {
+ bool dispatch_necessary = needs_asr_dispatching;
+
+ if ( !_Thread_Is_heir( executing ) && executing->is_preemptible ) {
+ dispatch_necessary = true;
+ _Thread_Dispatch_necessary = dispatch_necessary;
+ }
+
+ if ( dispatch_necessary ) {
+ _Thread_Dispatch();
+ }
+ }
+}
+
+/**
* This routine returns the C library re-enterant pointer.
*/
@@ -242,32 +268,6 @@ RTEMS_INLINE_ROUTINE void _Thread_Set_libc_reent (
_Thread_libc_reent = libc_reent;
}
-/**
- * This routine evaluates the current scheduling information for the
- * system and determines if a context switch is required. This
- * is usually called after changing an execution mode such as preemptability
- * for a thread.
- *
- * @param[in] are_signals_pending specifies whether or not the API
- * level signals are pending and a dispatch is needed.
- */
-RTEMS_INLINE_ROUTINE bool _Thread_Evaluate_is_dispatch_needed(
- bool are_signals_pending
-)
-{
- Thread_Control *executing;
-
- executing = _Thread_Executing;
-
- if ( are_signals_pending ||
- (!_Thread_Is_heir( executing ) && executing->is_preemptible) ) {
- _Thread_Dispatch_necessary = true;
- return true;
- }
-
- return false;
-}
-
/** @}*/
#endif