diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-07-18 11:53:48 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-07-22 16:46:01 +0200 |
commit | 05e82bd76b057bf60f8590c5226561538ba9057e (patch) | |
tree | fd84479c03e705bb5ab414b2364e0b131f6d2eef /cpukit/rtems/src/taskmode.c | |
parent | rtems: Error for task variables on SMP (diff) | |
download | rtems-05e82bd76b057bf60f8590c5226561538ba9057e.tar.bz2 |
score: Error for non-preemptible tasks on SMP
A common use case for disabled preemption was to ensure mutual exclusion
on single-processor configurations. On SMP this does not work.
To abandon non-preemptible tasks simplifies the scheduler.
Diffstat (limited to '')
-rw-r--r-- | cpukit/rtems/src/taskmode.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/cpukit/rtems/src/taskmode.c b/cpukit/rtems/src/taskmode.c index d9c7fce0ec..eb3636d172 100644 --- a/cpukit/rtems/src/taskmode.c +++ b/cpukit/rtems/src/taskmode.c @@ -19,6 +19,7 @@ #endif #include <rtems/system.h> +#include <rtems/config.h> #include <rtems/rtems/status.h> #include <rtems/rtems/support.h> #include <rtems/rtems/modes.h> @@ -67,8 +68,18 @@ rtems_status_code rtems_task_mode( /* * These are generic thread scheduling characteristics. */ - if ( mask & RTEMS_PREEMPT_MASK ) + if ( mask & RTEMS_PREEMPT_MASK ) { +#if defined( RTEMS_SMP ) + if ( + rtems_configuration_is_smp_enabled() + && !_Modes_Is_preempt( mode_set ) + ) { + return RTEMS_NOT_IMPLEMENTED; + } +#endif + executing->is_preemptible = _Modes_Is_preempt( mode_set ); + } if ( mask & RTEMS_TIMESLICE_MASK ) { if ( _Modes_Is_timeslice(mode_set) ) { |