Ignore:
Timestamp:
06/10/14 14:32:12 (9 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
8f0c7a46
Parents:
2d36931
git-author:
Sebastian Huber <sebastian.huber@…> (06/10/14 14:32:12)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/23/14 07:13:00)
Message:

score: Use chain nodes for ready queue support

This reduces the API to the minimum data structures to maximize the
re-usability.

File:
1 edited

Legend:

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

    r2d36931 r647b95d  
    6666
    6767/**
    68  * @brief Enqueues a thread on the specified ready queue.
    69  *
    70  * The thread is placed as the last element of its priority group.
    71  *
    72  * @param[in] the_thread The thread to enqueue.
     68 * @brief Enqueues a node on the specified ready queue.
     69 *
     70 * The node is placed as the last element of its priority group.
     71 *
     72 * @param[in] node The node to enqueue.
    7373 * @param[in] ready_queue The ready queue.
    7474 * @param[in] bit_map The priority bit map of the scheduler instance.
    7575 */
    7676RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_enqueue(
    77   Thread_Control                 *the_thread,
     77  Chain_Node                     *node,
    7878  Scheduler_priority_Ready_queue *ready_queue,
    7979  Priority_bit_map_Control       *bit_map
     
    8282  Chain_Control *ready_chain = ready_queue->ready_chain;
    8383
    84   _Chain_Append_unprotected( ready_chain, &the_thread->Object.Node );
     84  _Chain_Append_unprotected( ready_chain, node );
    8585  _Priority_bit_map_Add( bit_map, &ready_queue->Priority_map );
    8686}
    8787
    8888/**
    89  * @brief Enqueues a thread on the specified ready queue as first.
    90  *
    91  * The thread is placed as the first element of its priority group.
    92  *
    93  * @param[in] the_thread The thread to enqueue as first.
     89 * @brief Enqueues a node on the specified ready queue as first.
     90 *
     91 * The node is placed as the first element of its priority group.
     92 *
     93 * @param[in] node The node to enqueue as first.
    9494 * @param[in] ready_queue The ready queue.
    9595 * @param[in] bit_map The priority bit map of the scheduler instance.
    9696 */
    9797RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_enqueue_first(
    98   Thread_Control                 *the_thread,
     98  Chain_Node                     *node,
    9999  Scheduler_priority_Ready_queue *ready_queue,
    100100  Priority_bit_map_Control       *bit_map
     
    103103  Chain_Control *ready_chain = ready_queue->ready_chain;
    104104
    105   _Chain_Prepend_unprotected( ready_chain, &the_thread->Object.Node );
     105  _Chain_Prepend_unprotected( ready_chain, node );
    106106  _Priority_bit_map_Add( bit_map, &ready_queue->Priority_map );
    107107}
    108108
    109109/**
    110  * @brief Extracts a thread from the specified ready queue.
    111  *
    112  * @param[in] the_thread The thread to extract.
     110 * @brief Extracts a node from the specified ready queue.
     111 *
     112 * @param[in] node The node to extract.
    113113 * @param[in] ready_queue The ready queue.
    114114 * @param[in] bit_map The priority bit map of the scheduler instance.
    115115 */
    116116RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_extract(
    117   Thread_Control                 *the_thread,
     117  Chain_Node                     *node,
    118118  Scheduler_priority_Ready_queue *ready_queue,
    119119  Priority_bit_map_Control       *bit_map
     
    126126    _Priority_bit_map_Remove( bit_map, &ready_queue->Priority_map );
    127127  } else {
    128     _Chain_Extract_unprotected( &the_thread->Object.Node );
     128    _Chain_Extract_unprotected( node );
    129129  }
    130130}
     
    140140
    141141  _Scheduler_priority_Ready_queue_extract(
    142     the_thread,
     142    &the_thread->Object.Node,
    143143    &node->Ready_queue,
    144144    &context->Bit_map
     
    147147
    148148/**
    149  * @brief Return a pointer to the first thread.
    150  *
    151  * This routines returns a pointer to the first thread on @a ready_queues.
     149 * @brief Return a pointer to the first node.
     150 *
     151 * This routines returns a pointer to the first node on @a ready_queues.
    152152 *
    153153 * @param[in] bit_map The priority bit map of the scheduler instance.
    154154 * @param[in] ready_queues The ready queues of the scheduler instance.
    155155 *
    156  * @return This method returns the first thread or NULL
    157  */
    158 RTEMS_INLINE_ROUTINE Thread_Control *_Scheduler_priority_Ready_queue_first(
     156 * @return This method returns the first node.
     157 */
     158RTEMS_INLINE_ROUTINE Chain_Node *_Scheduler_priority_Ready_queue_first(
    159159  Priority_bit_map_Control *bit_map,
    160160  Chain_Control            *ready_queues
     
    163163  Priority_Control index = _Priority_bit_map_Get_highest( bit_map );
    164164
    165   return (Thread_Control *) _Chain_First( &ready_queues[ index ] );
     165  return _Chain_First( &ready_queues[ index ] );
    166166}
    167167
     
    180180  Scheduler_priority_Context *context =
    181181    _Scheduler_priority_Get_context( scheduler );
    182   Thread_Control *heir = _Scheduler_priority_Ready_queue_first(
    183     &context->Bit_map,
    184     &context->Ready[ 0 ]
    185   );
     182  Thread_Control *heir = (Thread_Control *)
     183    _Scheduler_priority_Ready_queue_first(
     184      &context->Bit_map,
     185      &context->Ready[ 0 ]
     186    );
    186187
    187188  ( void ) the_thread;
Note: See TracChangeset for help on using the changeset viewer.