From bfed5d5d15c814ebc9aefc988756fba14238f3f0 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 29 Jul 2013 15:06:02 +0200 Subject: [PATCH] smp: Support ASR path in rtems_task_mode() --- cpukit/rtems/src/taskmode.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cpukit/rtems/src/taskmode.c b/cpukit/rtems/src/taskmode.c index 3d6dee8105..606366b25f 100644 --- a/cpukit/rtems/src/taskmode.c +++ b/cpukit/rtems/src/taskmode.c @@ -32,11 +32,25 @@ static void _RTEMS_Tasks_Dispatch_if_necessary( if ( _Thread_Dispatch_is_enabled() ) { bool dispatch_necessary = needs_asr_dispatching; + /* + * FIXME: This locking approach is brittle. It only works since the + * current simple SMP scheduler has no support for the non-preempt mode. + */ +#if defined( RTEMS_SMP ) + ISR_Level level; + + _ISR_Disable( level ); +#endif + if ( !_Thread_Is_heir( executing ) && executing->is_preemptible ) { dispatch_necessary = true; _Thread_Dispatch_necessary = dispatch_necessary; } +#if defined( RTEMS_SMP ) + _ISR_Enable( level ); +#endif + if ( dispatch_necessary ) { _Thread_Dispatch(); }