diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-06-12 10:08:58 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-06-14 16:26:07 +0200 |
commit | 5c78940d9421e1c7f2cc5d44eddbf1dca0720ee8 (patch) | |
tree | 0d8431e7ac0138444bf688691612e2135e5949d4 /cpukit/score/inline | |
parent | score: Add and use _Thread_Dispatch_is_enabled() (diff) | |
download | rtems-5c78940d9421e1c7f2cc5d44eddbf1dca0720ee8.tar.bz2 |
score: Add and use _Thread_Dispatch_if_necessary()
Delete _Thread_Evaluate_is_dispatch_needed().
Use _Thread_Dispatch_is_enabled() in rtems_task_mode() instead of the
system state to determine if a thread dispatch is allowed. Signales are
now delivered in rtems_task_mode() even if preemption is disabled. This
is in line with rtems_signal_send().
Diffstat (limited to '')
-rw-r--r-- | cpukit/score/inline/rtems/score/thread.inl | 52 |
1 files changed, 26 insertions, 26 deletions
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 |