Ignore:
Timestamp:
Jun 3, 2014, 2:27:53 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
2d36931
Parents:
bd1431a
git-author:
Sebastian Huber <sebastian.huber@…> (06/03/14 14:27:53)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/23/14 07:13:00)
Message:

score: Remove scheduler parameter from most ops

Remove the scheduler parameter from most high level scheduler operations
like

  • _Scheduler_Block(),
  • _Scheduler_Unblock(),
  • _Scheduler_Change_priority(),
  • _Scheduler_Update_priority(),
  • _Scheduler_Release_job(), and
  • _Scheduler_Yield().

This simplifies the scheduler operations usage.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/include/rtems/score/schedulerimpl.h

    rbd1431a r92635cb  
    4242 */
    4343void _Scheduler_Handler_initialization( void );
     44
     45RTEMS_INLINE_ROUTINE const Scheduler_Control *_Scheduler_Get(
     46  const Thread_Control *the_thread
     47)
     48{
     49#if defined(RTEMS_SMP)
     50  return the_thread->scheduler;
     51#else
     52  (void) the_thread;
     53
     54  return &_Scheduler_Table[ 0 ];
     55#endif
     56}
    4457
    4558RTEMS_INLINE_ROUTINE const Scheduler_Control *_Scheduler_Get_by_CPU_index(
     
    8194
    8295/**
    83  * @brief Scheduler schedule.
     96 * @brief General scheduling decision.
    8497 *
    8598 * This kernel routine implements the scheduling decision logic for
     
    88101 * @param[in] the_thread The thread which state changed previously.
    89102 */
    90 RTEMS_INLINE_ROUTINE void _Scheduler_Schedule(
    91   const Scheduler_Control *scheduler,
    92   Thread_Control          *the_thread
    93 )
    94 {
     103RTEMS_INLINE_ROUTINE void _Scheduler_Schedule( Thread_Control *the_thread )
     104{
     105  const Scheduler_Control *scheduler = _Scheduler_Get( the_thread );
     106
    95107  ( *scheduler->Operations.schedule )( scheduler, the_thread );
    96108}
     
    104116 * @param[in] the_thread The yielding thread.
    105117 */
    106 RTEMS_INLINE_ROUTINE void _Scheduler_Yield(
    107   const Scheduler_Control *scheduler,
    108   Thread_Control          *the_thread
    109 )
    110 {
     118RTEMS_INLINE_ROUTINE void _Scheduler_Yield( Thread_Control *the_thread )
     119{
     120  const Scheduler_Control *scheduler = _Scheduler_Get( the_thread );
     121
    111122  ( *scheduler->Operations.yield )( scheduler, the_thread );
    112123}
    113124
    114125/**
    115  * @brief Scheduler block.
     126 * @brief Blocks a thread with respect to the scheduler.
    116127 *
    117128 * This routine removes @a the_thread from the scheduling decision for
     
    119130 * ready queue.  It performs any necessary schedulering operations
    120131 * including the selection of a new heir thread.
    121  */
    122 RTEMS_INLINE_ROUTINE void _Scheduler_Block(
    123   const Scheduler_Control *scheduler,
    124   Thread_Control               *the_thread
    125 )
    126 {
     132 *
     133 * @param[in] the_thread The thread.
     134 */
     135RTEMS_INLINE_ROUTINE void _Scheduler_Block( Thread_Control *the_thread )
     136{
     137  const Scheduler_Control *scheduler = _Scheduler_Get( the_thread );
     138
    127139  ( *scheduler->Operations.block )( scheduler, the_thread );
    128140}
    129141
    130142/**
    131  * @brief Scheduler unblock.
     143 * @brief Unblocks a thread with respect to the scheduler.
    132144 *
    133145 * This routine adds @a the_thread to the scheduling decision for
     
    135147 * ready queue per the schedulering policy and update any appropriate
    136148 * scheduling variables, for example the heir thread.
    137  */
    138 RTEMS_INLINE_ROUTINE void _Scheduler_Unblock(
    139   const Scheduler_Control *scheduler,
    140   Thread_Control          *the_thread
    141 )
    142 {
     149 *
     150 * @param[in] the_thread The thread.
     151 */
     152RTEMS_INLINE_ROUTINE void _Scheduler_Unblock( Thread_Control *the_thread )
     153{
     154  const Scheduler_Control *scheduler = _Scheduler_Get( the_thread );
     155
    143156  ( *scheduler->Operations.unblock )( scheduler, the_thread );
    144157}
     
    151164 * current priority value.
    152165 *
    153  * @param[in] scheduler The scheduler instance.
    154166 * @param[in] the_thread The thread changing its priority.
    155167 * @param[in] new_priority The new thread priority.
     
    159171 */
    160172RTEMS_INLINE_ROUTINE void _Scheduler_Change_priority(
    161   const Scheduler_Control *scheduler,
    162173  Thread_Control          *the_thread,
    163174  Priority_Control         new_priority,
     
    165176)
    166177{
     178  const Scheduler_Control *scheduler = _Scheduler_Get( the_thread );
     179
    167180  ( *scheduler->Operations.change_priority )(
    168181    scheduler,
     
    216229 */
    217230RTEMS_INLINE_ROUTINE void _Scheduler_Update_priority(
    218   const Scheduler_Control *scheduler,
    219   Thread_Control          *the_thread,
    220   Priority_Control         new_priority
    221 )
    222 {
     231  Thread_Control   *the_thread,
     232  Priority_Control  new_priority
     233)
     234{
     235  const Scheduler_Control *scheduler = _Scheduler_Get( the_thread );
     236
    223237  ( *scheduler->Operations.update_priority )(
    224238    scheduler,
     
    254268
    255269/**
    256  * @brief Scheduler release job.
    257  *
    258  * This routine is called when a new period of task is issued.
     270 * @brief Releases a job of a thread with respect to the scheduler.
     271 *
     272 * @param[in] the_thread The thread.
     273 * @param[in] length The period length.
    259274 */
    260275RTEMS_INLINE_ROUTINE void _Scheduler_Release_job(
    261   const Scheduler_Control *scheduler,
    262   Thread_Control          *the_thread,
    263   uint32_t                 length
    264 )
    265 {
     276  Thread_Control *the_thread,
     277  uint32_t        length
     278)
     279{
     280  const Scheduler_Control *scheduler = _Scheduler_Get( the_thread );
     281
    266282  ( *scheduler->Operations.release_job )( scheduler, the_thread, length );
    267283}
     
    346362
    347363  return true;
    348 #endif
    349 }
    350 
    351 RTEMS_INLINE_ROUTINE const Scheduler_Control *_Scheduler_Get(
    352   const Thread_Control *the_thread
    353 )
    354 {
    355 #if defined(RTEMS_SMP)
    356   return the_thread->scheduler;
    357 #else
    358   (void) the_thread;
    359 
    360   return &_Scheduler_Table[ 0 ];
    361364#endif
    362365}
     
    375378    the_thread->scheduler = scheduler;
    376379    _Scheduler_Node_initialize( scheduler, the_thread );
    377     _Scheduler_Update_priority(
    378       scheduler,
    379       the_thread,
    380       the_thread->current_priority
    381     );
     380    _Scheduler_Update_priority( the_thread, the_thread->current_priority );
    382381    _Thread_Clear_state( the_thread, STATES_MIGRATING );
    383382  }
Note: See TracChangeset for help on using the changeset viewer.