diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-08-07 21:19:55 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-08-20 10:14:02 +0200 |
commit | e5ca54c99682a264568d95d8a5db555ea8357e9c (patch) | |
tree | 8d0ab9e455831ae28229832937b6e24c243c607d /cpukit/score/include/rtems/score/schedulerimpl.h | |
parent | correct memory model in smpatomic test case (diff) | |
download | rtems-e5ca54c99682a264568d95d8a5db555ea8357e9c.tar.bz2 |
score: PR2136: Fix _Thread_Change_priority()
Add call to _Scheduler_Schedule() in missing path after
_Thread_Set_transient() in _Thread_Change_priority(). See also
sptests/spintrcritical19.
Add thread parameter to _Scheduler_Schedule(). This parameter is
currently unused but may be used in future SMP schedulers.
Do heir selection in _Scheduler_Schedule(). Use
_Scheduler_Update_heir() for this in the particular scheduler
implementation.
Add and use _Scheduler_Generic_block().
Diffstat (limited to 'cpukit/score/include/rtems/score/schedulerimpl.h')
-rw-r--r-- | cpukit/score/include/rtems/score/schedulerimpl.h | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h index 5ea4bb8b74..2d9957a62a 100644 --- a/cpukit/score/include/rtems/score/schedulerimpl.h +++ b/cpukit/score/include/rtems/score/schedulerimpl.h @@ -20,6 +20,7 @@ #define _RTEMS_SCORE_SCHEDULERIMPL_H #include <rtems/score/scheduler.h> +#include <rtems/score/threadimpl.h> #ifdef __cplusplus extern "C" { @@ -59,10 +60,12 @@ void _Scheduler_Handler_initialization( void ); * * This kernel routine implements the scheduling decision logic for * the scheduler. It does NOT dispatch. + * + * @param[in] thread The thread which state changed previously. */ -RTEMS_INLINE_ROUTINE void _Scheduler_Schedule( void ) +RTEMS_INLINE_ROUTINE void _Scheduler_Schedule( Thread_Control *thread ) { - _Scheduler.Operations.schedule(); + _Scheduler.Operations.schedule( thread ); } /** @@ -237,6 +240,34 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Start_idle( ( *_Scheduler.Operations.start_idle )( thread, processor ); } +RTEMS_INLINE_ROUTINE void _Scheduler_Update_heir( + Thread_Control *heir, + bool force_dispatch +) +{ + Thread_Control *executing = _Thread_Executing; + + _Thread_Heir = heir; + + if ( executing != heir && ( force_dispatch || executing->is_preemptible ) ) + _Thread_Dispatch_necessary = true; +} + +RTEMS_INLINE_ROUTINE void _Scheduler_Generic_block( + void ( *extract )( Thread_Control *thread ), + void ( *schedule )( Thread_Control *thread, bool force_dispatch ), + Thread_Control *thread +) +{ + ( *extract )( thread ); + + /* TODO: flash critical section? */ + + if ( _Thread_Is_executing( thread ) || _Thread_Is_heir( thread ) ) { + ( *schedule )( thread, true ); + } +} + /** * Macro testing whether @a p1 has lower priority than @a p2 * in the intuitive sense of priority. |