diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-06-11 14:31:03 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-07-08 16:30:48 +0200 |
commit | 8568341d69d16609a3dcf71716a89839b16ac881 (patch) | |
tree | 900c88db84557962dda75671eedd39911e1f2dc5 /cpukit/score/include/rtems/score/schedulerimpl.h | |
parent | score: Add _Scheduler_Help() (diff) | |
download | rtems-8568341d69d16609a3dcf71716a89839b16ac881.tar.bz2 |
score: Need for help indicator for scheduler ops
Return a thread in need for help for the following scheduler operations
- unblock,
- change priority, and
- yield.
A thread in need for help is a thread that encounters a scheduler state
change from scheduled to ready or a thread that cannot be scheduled in
an unblock operation. Such a thread can ask threads which depend on
resources owned by this thread for help.
Diffstat (limited to 'cpukit/score/include/rtems/score/schedulerimpl.h')
-rw-r--r-- | cpukit/score/include/rtems/score/schedulerimpl.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h index edb68b649a..5e4e5098d2 100644 --- a/cpukit/score/include/rtems/score/schedulerimpl.h +++ b/cpukit/score/include/rtems/score/schedulerimpl.h @@ -116,6 +116,24 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Schedule( Thread_Control *the_thread ) ( *scheduler->Operations.schedule )( scheduler, the_thread ); } +#if defined(RTEMS_SMP) +/** + * @brief Ask threads depending on resources owned by the thread for help. + * + * A thread is in need for help if it lost its assigned processor due to + * pre-emption by a higher priority thread or it was not possible to assign it + * a processor since its priority is to low on its current scheduler instance. + * + * @param[in] needs_help The thread needing help. + */ +RTEMS_INLINE_ROUTINE void _Scheduler_Ask_for_help_if_necessary( + Thread_Control *needs_help +) +{ + (void) needs_help; +} +#endif + /** * @brief Scheduler yield with a particular thread. * @@ -127,8 +145,16 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Schedule( Thread_Control *the_thread ) RTEMS_INLINE_ROUTINE void _Scheduler_Yield( Thread_Control *the_thread ) { const Scheduler_Control *scheduler = _Scheduler_Get( the_thread ); +#if defined(RTEMS_SMP) + Thread_Control *needs_help; + needs_help = +#endif ( *scheduler->Operations.yield )( scheduler, the_thread ); + +#if defined(RTEMS_SMP) + _Scheduler_Ask_for_help_if_necessary( needs_help ); +#endif } /** @@ -161,8 +187,16 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Block( Thread_Control *the_thread ) RTEMS_INLINE_ROUTINE void _Scheduler_Unblock( Thread_Control *the_thread ) { const Scheduler_Control *scheduler = _Scheduler_Get( the_thread ); +#if defined(RTEMS_SMP) + Thread_Control *needs_help; + needs_help = +#endif ( *scheduler->Operations.unblock )( scheduler, the_thread ); + +#if defined(RTEMS_SMP) + _Scheduler_Ask_for_help_if_necessary( needs_help ); +#endif } /** @@ -185,13 +219,21 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Change_priority( ) { const Scheduler_Control *scheduler = _Scheduler_Get( the_thread ); +#if defined(RTEMS_SMP) + Thread_Control *needs_help; + needs_help = +#endif ( *scheduler->Operations.change_priority )( scheduler, the_thread, new_priority, prepend_it ); + +#if defined(RTEMS_SMP) + _Scheduler_Ask_for_help_if_necessary( needs_help ); +#endif } /** |