diff options
Diffstat (limited to 'cpukit/rtems/src')
-rw-r--r-- | cpukit/rtems/src/taskmode.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/cpukit/rtems/src/taskmode.c b/cpukit/rtems/src/taskmode.c index 377224c98a..96bed470f4 100644 --- a/cpukit/rtems/src/taskmode.c +++ b/cpukit/rtems/src/taskmode.c @@ -94,31 +94,37 @@ rtems_status_code rtems_task_mode( if ( ( mask & ( RTEMS_ASR_MASK | RTEMS_PREEMPT_MASK ) ) != 0 ) { bool need_thread_dispatch; ISR_lock_Context lock_context; - bool previous_asr_is_enabled; - bool previous_is_preemptible; need_thread_dispatch = false; _Thread_State_acquire( executing, &lock_context ); - previous_asr_is_enabled = asr->is_enabled; - asr->is_enabled = !_Modes_Is_asr_disabled( mode_set ); + if ( ( mask & RTEMS_ASR_MASK ) != 0 ) { + bool previous_asr_is_enabled; - if ( - !previous_asr_is_enabled && - asr->is_enabled && - asr->signals_pending != 0 - ) { - need_thread_dispatch = true; - _Thread_Append_post_switch_action( executing, &api->Signal_action ); + previous_asr_is_enabled = asr->is_enabled; + asr->is_enabled = !_Modes_Is_asr_disabled( mode_set ); + + if ( + !previous_asr_is_enabled && + asr->is_enabled && + asr->signals_pending != 0 + ) { + need_thread_dispatch = true; + _Thread_Append_post_switch_action( executing, &api->Signal_action ); + } } - previous_is_preemptible = executing->is_preemptible; - executing->is_preemptible = _Modes_Is_preempt( mode_set ); + if ( ( mask & RTEMS_PREEMPT_MASK ) != 0 ) { + bool previous_is_preemptible; + + previous_is_preemptible = executing->is_preemptible; + executing->is_preemptible = _Modes_Is_preempt( mode_set ); - if ( executing->is_preemptible && !previous_is_preemptible ) { - need_thread_dispatch = true; - _Scheduler_Schedule( executing ); + if ( executing->is_preemptible && !previous_is_preemptible ) { + need_thread_dispatch = true; + _Scheduler_Schedule( executing ); + } } if ( need_thread_dispatch ) { |