Changeset e273501 in rtems


Ignore:
Timestamp:
Jun 24, 2015, 9:05:39 AM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
d7665823
Parents:
579f16ef
git-author:
Sebastian Huber <sebastian.huber@…> (06/24/15 09:05:39)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/23/15 06:00:19)
Message:

score: Introduce Thread_queue_Queue

Separate the thread queue heads and lock from the operations. This
enables the support for light weight objects which only support one
queuing discipline.

Files:
20 edited

Legend:

Unmodified
Added
Removed
  • cpukit/posix/src/killinfo.c

    r579f16ef re273501  
    141141  /* XXX violation of visibility -- need to define thread queue support */
    142142
    143   the_chain = &_POSIX_signals_Wait_queue.Queues.Fifo;
     143  the_chain = &_POSIX_signals_Wait_queue.Queue.Heads.Fifo;
    144144
    145145  for ( the_node = _Chain_First( the_chain );
  • cpukit/posix/src/sigtimedwait.c

    r579f16ef re273501  
    157157    executing->Wait.return_argument = the_info;
    158158    _Thread_queue_Enqueue_critical(
    159       &_POSIX_signals_Wait_queue,
     159      &_POSIX_signals_Wait_queue.Queue,
     160      _POSIX_signals_Wait_queue.operations,
    160161      executing,
    161162      STATES_WAITING_FOR_SIGNAL | STATES_INTERRUPTIBLE_BY_SIGNAL,
  • cpukit/score/include/rtems/score/coremsgimpl.h

    r579f16ef re273501  
    600600
    601601  _Thread_queue_Extract_critical(
    602     &the_message_queue->Wait_queue,
     602    &the_message_queue->Wait_queue.Queue,
     603    the_message_queue->Wait_queue.operations,
    603604    the_thread,
    604605    lock_context
  • cpukit/score/include/rtems/score/coresemimpl.h

    r579f16ef re273501  
    141141
    142142    _Thread_queue_Extract_critical(
    143       &the_semaphore->Wait_queue,
     143      &the_semaphore->Wait_queue.Queue,
     144      the_semaphore->Wait_queue.operations,
    144145      the_thread,
    145146      lock_context
     
    264265  executing->Wait.id = id;
    265266  _Thread_queue_Enqueue_critical(
    266     &the_semaphore->Wait_queue,
     267    &the_semaphore->Wait_queue.Queue,
     268    the_semaphore->Wait_queue.operations,
    267269    executing,
    268270    STATES_WAITING_FOR_SEMAPHORE,
  • cpukit/score/include/rtems/score/thread.h

    r579f16ef re273501  
    330330   * @see _Thread_Lock_set() and _Thread_Wait_set_queue().
    331331   */
    332   Thread_queue_Control *queue;
     332  Thread_queue_Queue *queue;
    333333
    334334  /**
  • cpukit/score/include/rtems/score/threadimpl.h

    r579f16ef re273501  
    13691369 */
    13701370RTEMS_INLINE_ROUTINE void _Thread_Wait_set_queue(
    1371   Thread_Control       *the_thread,
    1372   Thread_queue_Control *new_queue
     1371  Thread_Control     *the_thread,
     1372  Thread_queue_Queue *new_queue
    13731373)
    13741374{
  • cpukit/score/include/rtems/score/threadq.h

    r579f16ef re273501  
    4242typedef struct Thread_Control Thread_Control;
    4343
    44 typedef struct Thread_queue_Control Thread_queue_Control;
     44typedef struct {
     45  /** This union contains the data structures used to manage the blocked
     46   *  set of tasks which varies based upon the discipline.
     47   */
     48  union {
     49    /** This is the FIFO discipline list. */
     50    Chain_Control Fifo;
     51    /** This is the set of threads for priority discipline waiting. */
     52    RBTree_Control Priority;
     53  } Heads;
     54
     55  /**
     56   * @brief Lock to protect this thread queue.
     57   *
     58   * It may be used to protect additional state of the object embedding this
     59   * thread queue.
     60   *
     61   * @see _Thread_queue_Acquire(), _Thread_queue_Acquire_critical() and
     62   * _Thread_queue_Release().
     63   */
     64  ISR_LOCK_MEMBER( Lock )
     65} Thread_queue_Queue;
    4566
    4667/**
     
    4970 * @param[in] the_thread The thread.
    5071 * @param[in] new_priority The new priority value.
    51  * @param[in] the_thread_queue The thread queue.
     72 * @param[in] queue The actual thread queue.
    5273 *
    5374 * @see Thread_queue_Operations.
    5475 */
    5576typedef void ( *Thread_queue_Priority_change_operation )(
    56   Thread_Control       *the_thread,
    57   Priority_Control      new_priority,
    58   Thread_queue_Control *the_thread_queue
     77  Thread_Control     *the_thread,
     78  Priority_Control    new_priority,
     79  Thread_queue_Queue *queue
    5980);
    6081
     
    6283 * @brief Thread queue initialize operation.
    6384 *
    64  * @param[in] the_thread_queue The thread queue.
     85 * @param[in] queue The actual thread queue.
    6586 *
    6687 * @see _Thread_Wait_set_operations().
    6788 */
    6889typedef void ( *Thread_queue_Initialize_operation )(
    69   Thread_queue_Control *the_thread_queue
     90  Thread_queue_Queue *queue
    7091);
    7192
     
    7394 * @brief Thread queue enqueue operation.
    7495 *
    75  * @param[in] the_thread_queue The thread queue.
     96 * @param[in] queue The actual thread queue.
    7697 * @param[in] the_thread The thread to enqueue on the queue.
    7798 *
     
    79100 */
    80101typedef void ( *Thread_queue_Enqueue_operation )(
    81   Thread_queue_Control *the_thread_queue,
    82   Thread_Control       *the_thread
     102  Thread_queue_Queue *queue,
     103  Thread_Control     *the_thread
    83104);
    84105
     
    86107 * @brief Thread queue extract operation.
    87108 *
    88  * @param[in] the_thread_queue The thread queue.
     109 * @param[in] queue The actual thread queue.
    89110 * @param[in] the_thread The thread to extract from the thread queue.
    90111 *
     
    92113 */
    93114typedef void ( *Thread_queue_Extract_operation )(
    94   Thread_queue_Control *the_thread_queue,
    95   Thread_Control       *the_thread
     115  Thread_queue_Queue *queue,
     116  Thread_Control     *the_thread
    96117);
    97118
     
    99120 * @brief Thread queue first operation.
    100121 *
    101  * @param[in] the_thread_queue The thread queue.
     122 * @param[in] queue The actual thread queue.
    102123 *
    103124 * @retval NULL No thread is present on the thread queue.
     
    108129 */
    109130typedef Thread_Control *( *Thread_queue_First_operation )(
    110   Thread_queue_Control *the_thread_queue
     131  Thread_queue_Queue *queue
    111132);
    112133
     
    169190 *  waiting to acquire a resource.
    170191 */
    171 struct Thread_queue_Control {
    172   /** This union contains the data structures used to manage the blocked
    173    *  set of tasks which varies based upon the discipline.
    174    */
    175   union {
    176     /** This is the FIFO discipline list. */
    177     Chain_Control Fifo;
    178     /** This is the set of threads for priority discipline waiting. */
    179     RBTree_Control Priority;
    180   } Queues;
    181 
    182   /**
    183    * @brief The operations for this thread queue.
     192typedef struct {
     193  /**
     194   * @brief The actual thread queue.
     195   */
     196  Thread_queue_Queue Queue;
     197
     198  /**
     199   * @brief The operations for the actual thread queue.
    184200   */
    185201  const Thread_queue_Operations *operations;
    186 
    187   /**
    188    * @brief Lock to protect this thread queue.
    189    *
    190    * It may be used to protect additional state of the object embedding this
    191    * thread queue.
    192    *
    193    * @see _Thread_queue_Acquire(), _Thread_queue_Acquire_critical() and
    194    * _Thread_queue_Release().
    195    */
    196   ISR_LOCK_MEMBER( Lock )
    197 };
     202} Thread_queue_Control;
    198203
    199204/**@}*/
  • cpukit/score/include/rtems/score/threadqimpl.h

    r579f16ef re273501  
    3434/**@{*/
    3535
     36RTEMS_INLINE_ROUTINE void _Thread_queue_Queue_acquire_critical(
     37  Thread_queue_Queue *queue,
     38  ISR_lock_Context   *lock_context
     39)
     40{
     41  _ISR_lock_Acquire( &queue->Lock, lock_context );
     42}
     43
     44RTEMS_INLINE_ROUTINE void _Thread_queue_Queue_release(
     45  Thread_queue_Queue *queue,
     46  ISR_lock_Context   *lock_context
     47)
     48{
     49  _ISR_lock_Release_and_ISR_enable( &queue->Lock, lock_context );
     50}
     51
    3652RTEMS_INLINE_ROUTINE void _Thread_queue_Acquire_critical(
    3753  Thread_queue_Control *the_thread_queue,
     
    3955)
    4056{
    41   _ISR_lock_Acquire( &the_thread_queue->Lock, lock_context );
     57  _Thread_queue_Queue_acquire_critical(
     58    &the_thread_queue->Queue,
     59    lock_context
     60  );
    4261}
    4362
     
    5675)
    5776{
    58   _ISR_lock_Release_and_ISR_enable( &the_thread_queue->Lock, lock_context );
     77  _Thread_queue_Queue_release( &the_thread_queue->Queue, lock_context );
    5978}
    6079
     
    121140 *   } else {
    122141 *     _Thread_queue_Enqueue_critical(
    123  *       &mutex->Queue,
     142 *       &mutex->Queue.Queue,
     143 *       mutex->Queue.operations,
    124144 *       executing,
    125145 *       STATES_WAITING_FOR_MUTEX,
     
    132152 * @endcode
    133153 *
    134  * @param[in] the_thread_queue The thread queue.
     154 * @param[in] queue The actual thread queue.
     155 * @param[in] operations The thread queue operations.
    135156 * @param[in] the_thread The thread to enqueue.
    136157 * @param[in] state The new state of the thread.
     
    141162 */
    142163void _Thread_queue_Enqueue_critical(
    143   Thread_queue_Control *the_thread_queue,
    144   Thread_Control       *the_thread,
    145   States_Control        state,
    146   Watchdog_Interval     timeout,
    147   uint32_t              timeout_code,
    148   ISR_lock_Context     *lock_context
     164  Thread_queue_Queue            *queue,
     165  const Thread_queue_Operations *operations,
     166  Thread_Control                *the_thread,
     167  States_Control                 state,
     168  Watchdog_Interval              timeout,
     169  uint32_t                       timeout_code,
     170  ISR_lock_Context              *lock_context
    149171);
    150172
     
    165187  _Thread_queue_Acquire( the_thread_queue, &lock_context );
    166188  _Thread_queue_Enqueue_critical(
    167     the_thread_queue,
     189    &the_thread_queue->Queue,
     190    the_thread_queue->operations,
    168191    the_thread,
    169192    state,
     
    181204 * lock is not released.
    182205 *
    183  * @param[in] the_thread_queue The thread queue.
     206 * @param[in] queue The actual thread queue.
     207 * @param[in] operations The thread queue operations.
    184208 * @param[in] the_thread The thread to extract.
    185209 */
    186210void _Thread_queue_Extract_locked(
    187   Thread_queue_Control *the_thread_queue,
    188   Thread_Control       *the_thread
     211  Thread_queue_Queue            *queue,
     212  const Thread_queue_Operations *operations,
     213  Thread_Control                *the_thread
    189214);
    190215
     
    197222 * dispatching is enabled once the sequence to unblock the thread is complete.
    198223 *
    199  * @param[in] the_thread_queue The thread queue.
     224 * @param[in] queue The actual thread queue.
    200225 * @param[in] the_thread The thread to extract.
    201226 * @param[in] lock_context The lock context of the lock acquire.
    202227 */
    203228void _Thread_queue_Unblock_critical(
    204   Thread_queue_Control *the_thread_queue,
    205   Thread_Control       *the_thread,
    206   ISR_lock_Context     *lock_context
     229  Thread_queue_Queue *queue,
     230  Thread_Control     *the_thread,
     231  ISR_lock_Context   *lock_context
    207232);
    208233
     
    239264 *   if ( first != NULL ) {
    240265 *     _Thread_queue_Extract_critical(
    241  *       &mutex->Queue,
     266 *       &mutex->Queue.Queue,
     267 *       mutex->Queue.operations,
    242268 *       first,
    243269 *       &lock_context
     
    246272 * @endcode
    247273 *
    248  * @param[in] the_thread_queue The thread queue.
     274 * @param[in] queue The actual thread queue.
     275 * @param[in] operations The thread queue operations.
    249276 * @param[in] the_thread The thread to extract.
    250277 * @param[in] lock_context The lock context of the lock acquire.
    251278 */
    252279void _Thread_queue_Extract_critical(
    253   Thread_queue_Control *the_thread_queue,
    254   Thread_Control       *the_thread,
    255   ISR_lock_Context     *lock_context
     280  Thread_queue_Queue            *queue,
     281  const Thread_queue_Operations *operations,
     282  Thread_Control                *the_thread,
     283  ISR_lock_Context              *lock_context
    256284);
    257285
     
    295323)
    296324{
    297   return ( *the_thread_queue->operations->first )( the_thread_queue );
     325  return ( *the_thread_queue->operations->first )( &the_thread_queue->Queue );
    298326}
    299327
     
    347375#if defined(RTEMS_SMP)
    348376  #define THREAD_QUEUE_FIFO_INITIALIZER( designator, name ) { \
    349       .Queues = { \
    350         .Fifo = CHAIN_INITIALIZER_EMPTY( designator.Queues.Fifo ) \
     377      .Queue = { \
     378        .Heads = { \
     379          .Fifo = CHAIN_INITIALIZER_EMPTY( designator.Queue.Heads.Fifo ) \
     380        }, \
     381        .Lock = ISR_LOCK_INITIALIZER( name ), \
    351382      }, \
    352       .operations = &_Thread_queue_Operations_FIFO, \
    353       .Lock = ISR_LOCK_INITIALIZER( name ) \
     383      .operations = &_Thread_queue_Operations_FIFO \
    354384    }
    355385
    356386  #define THREAD_QUEUE_PRIORITY_INITIALIZER( designator, name ) { \
    357       .Queues = { \
    358         .Priority = RBTREE_INITIALIZER_EMPTY( designator.Queues.Priority ) \
     387      .Queue = { \
     388        .Heads = { \
     389          .Priority = RBTREE_INITIALIZER_EMPTY( \
     390            designator.Queue.Heads.Priority \
     391          ) \
     392        }, \
     393        .Lock = ISR_LOCK_INITIALIZER( name ), \
    359394      }, \
    360       .operations = &_Thread_queue_Operations_priority, \
    361       .Lock = ISR_LOCK_INITIALIZER( name ) \
     395      .operations = &_Thread_queue_Operations_priority \
    362396    }
    363397#else
    364398  #define THREAD_QUEUE_FIFO_INITIALIZER( designator, name ) { \
    365       .Queues = { \
    366         .Fifo = CHAIN_INITIALIZER_EMPTY( designator.Queues.Fifo ) \
     399      .Queue = { \
     400        .Heads = { \
     401          .Fifo = CHAIN_INITIALIZER_EMPTY( designator.Queue.Heads.Fifo ) \
     402        } \
    367403      }, \
    368404      .operations = &_Thread_queue_Operations_FIFO \
     
    370406
    371407  #define THREAD_QUEUE_PRIORITY_INITIALIZER( designator, name ) { \
    372       .Queues = { \
    373         .Priority = RBTREE_INITIALIZER_EMPTY( designator.Queues.Priority ) \
     408      .Queue = { \
     409        .Heads = { \
     410          .Priority = RBTREE_INITIALIZER_EMPTY( \
     411            designator.Queue.Heads.Priority \
     412          ) \
     413        } \
    374414      }, \
    375415      .operations = &_Thread_queue_Operations_priority \
     
    381421)
    382422{
    383   _ISR_lock_Destroy( &the_thread_queue->Lock );
     423  _ISR_lock_Destroy( &the_thread_queue->Queue.Lock );
    384424}
    385425
  • cpukit/score/src/corebarrierwait.c

    r579f16ef re273501  
    5151
    5252  _Thread_queue_Enqueue_critical(
    53     &the_barrier->Wait_queue,
     53    &the_barrier->Wait_queue.Queue,
     54    the_barrier->Wait_queue.operations,
    5455    executing,
    5556    STATES_WAITING_FOR_BARRIER,
  • cpukit/score/src/coremsgseize.c

    r579f16ef re273501  
    108108      );
    109109      _Thread_queue_Extract_critical(
    110         &the_message_queue->Wait_queue,
     110        &the_message_queue->Wait_queue.Queue,
     111        the_message_queue->Wait_queue.operations,
    111112        the_thread,
    112113        lock_context
     
    132133
    133134  _Thread_queue_Enqueue_critical(
    134     &the_message_queue->Wait_queue,
     135    &the_message_queue->Wait_queue.Queue,
     136    the_message_queue->Wait_queue.operations,
    135137    executing,
    136138    STATES_WAITING_FOR_MESSAGE,
  • cpukit/score/src/coremsgsubmit.c

    r579f16ef re273501  
    133133
    134134    _Thread_queue_Enqueue_critical(
    135       &the_message_queue->Wait_queue,
     135      &the_message_queue->Wait_queue.Queue,
     136      the_message_queue->Wait_queue.operations,
    136137      executing,
    137138      STATES_WAITING_FOR_MESSAGE,
  • cpukit/score/src/coremutexseize.c

    r579f16ef re273501  
    8484
    8585  _Thread_queue_Enqueue_critical(
    86     &the_mutex->Wait_queue,
     86    &the_mutex->Wait_queue.Queue,
     87    the_mutex->Wait_queue.operations,
    8788    executing,
    8889    STATES_WAITING_FOR_MUTEX,
  • cpukit/score/src/coremutexsurrender.c

    r579f16ef re273501  
    186186     * acquire.
    187187     */
    188     _Thread_queue_Extract_locked( &the_mutex->Wait_queue, the_thread );
     188    _Thread_queue_Extract_locked(
     189      &the_mutex->Wait_queue.Queue,
     190      the_mutex->Wait_queue.operations,
     191      the_thread
     192    );
    189193
    190194#if defined(RTEMS_MULTIPROCESSING)
     
    217221
    218222    _Thread_queue_Unblock_critical(
    219       &the_mutex->Wait_queue,
     223      &the_mutex->Wait_queue.Queue,
    220224      the_thread,
    221225      lock_context
  • cpukit/score/src/corerwlockobtainread.c

    r579f16ef re273501  
    8484
    8585    _Thread_queue_Enqueue_critical(
    86        &the_rwlock->Wait_queue,
     86       &the_rwlock->Wait_queue.Queue,
     87       the_rwlock->Wait_queue.operations,
    8788       executing,
    8889       STATES_WAITING_FOR_RWLOCK,
  • cpukit/score/src/corerwlockobtainwrite.c

    r579f16ef re273501  
    7474
    7575    _Thread_queue_Enqueue_critical(
    76        &the_rwlock->Wait_queue,
     76       &the_rwlock->Wait_queue.Queue,
     77       the_rwlock->Wait_queue.operations,
    7778       executing,
    7879       STATES_WAITING_FOR_RWLOCK,
  • cpukit/score/src/threadq.c

    r579f16ef re273501  
    5151  const Thread_queue_Operations *operations;
    5252
    53   _ISR_lock_Initialize( &the_thread_queue->Lock, "Thread Queue" );
     53  _ISR_lock_Initialize( &the_thread_queue->Queue.Lock, "Thread Queue" );
    5454
    5555  if ( the_discipline == THREAD_QUEUE_DISCIPLINE_PRIORITY ) {
     
    6161
    6262  the_thread_queue->operations = operations;
    63   ( *operations->initialize )( the_thread_queue );
     63  ( *operations->initialize )( &the_thread_queue->Queue );
    6464}
  • cpukit/score/src/threadqenqueue.c

    r579f16ef re273501  
    4747
    4848void _Thread_queue_Enqueue_critical(
    49   Thread_queue_Control *the_thread_queue,
    50   Thread_Control       *the_thread,
    51   States_Control        state,
    52   Watchdog_Interval     timeout,
    53   uint32_t              timeout_code,
    54   ISR_lock_Context     *lock_context
    55 )
    56 {
    57   const Thread_queue_Operations *operations;
    58   Per_CPU_Control               *cpu_self;
    59   bool                           success;
    60 
    61   _Thread_Lock_set( the_thread, &the_thread_queue->Lock );
    62 
    63   operations = the_thread_queue->operations;
    64   _Thread_Wait_set_queue( the_thread, the_thread_queue );
     49  Thread_queue_Queue            *queue,
     50  const Thread_queue_Operations *operations,
     51  Thread_Control                *the_thread,
     52  States_Control                 state,
     53  Watchdog_Interval              timeout,
     54  uint32_t                       timeout_code,
     55  ISR_lock_Context              *lock_context
     56)
     57{
     58  Per_CPU_Control *cpu_self;
     59  bool             success;
     60
     61  _Thread_Lock_set( the_thread, &queue->Lock );
     62
     63  _Thread_Wait_set_queue( the_thread, queue );
    6564  _Thread_Wait_set_operations( the_thread, operations );
    6665
    67   ( *operations->enqueue )( the_thread_queue, the_thread );
     66  ( *operations->enqueue )( queue, the_thread );
    6867
    6968  _Thread_Wait_flags_set( the_thread, THREAD_QUEUE_INTEND_TO_BLOCK );
    7069  cpu_self = _Thread_Dispatch_disable_critical( lock_context );
    71   _Thread_queue_Release( the_thread_queue, lock_context );
     70  _Thread_queue_Queue_release( queue, lock_context );
    7271
    7372#if defined(RTEMS_MULTIPROCESSING)
     
    103102
    104103void _Thread_queue_Extract_locked(
    105   Thread_queue_Control *the_thread_queue,
    106   Thread_Control       *the_thread
    107 )
    108 {
    109   ( *the_thread_queue->operations->extract )( the_thread_queue, the_thread );
     104  Thread_queue_Queue            *queue,
     105  const Thread_queue_Operations *operations,
     106  Thread_Control                *the_thread
     107)
     108{
     109  ( *operations->extract )( queue, the_thread );
    110110
    111111  _Thread_Wait_set_queue( the_thread, NULL );
     
    115115
    116116void _Thread_queue_Unblock_critical(
    117   Thread_queue_Control *the_thread_queue,
    118   Thread_Control       *the_thread,
    119   ISR_lock_Context     *lock_context
     117  Thread_queue_Queue *queue,
     118  Thread_Control     *the_thread,
     119  ISR_lock_Context   *lock_context
    120120)
    121121{
     
    140140
    141141    cpu_self = _Thread_Dispatch_disable_critical( lock_context );
    142     _Thread_queue_Release( the_thread_queue, lock_context );
     142    _Thread_queue_Queue_release( queue, lock_context );
    143143
    144144    _Thread_queue_Unblock( the_thread );
     
    146146    _Thread_Dispatch_enable( cpu_self );
    147147  } else {
    148     _Thread_queue_Release( the_thread_queue, lock_context );
     148    _Thread_queue_Queue_release( queue, lock_context );
    149149  }
    150150}
    151151
    152152void _Thread_queue_Extract_critical(
    153   Thread_queue_Control *the_thread_queue,
    154   Thread_Control       *the_thread,
    155   ISR_lock_Context     *lock_context
    156 )
    157 {
    158   _Thread_queue_Extract_locked( the_thread_queue, the_thread );
    159   _Thread_queue_Unblock_critical( the_thread_queue, the_thread, lock_context );
     153  Thread_queue_Queue            *queue,
     154  const Thread_queue_Operations *operations,
     155  Thread_Control                *the_thread,
     156  ISR_lock_Context              *lock_context
     157)
     158{
     159  _Thread_queue_Extract_locked( queue, operations, the_thread );
     160  _Thread_queue_Unblock_critical( queue, the_thread, lock_context );
    160161}
    161162
    162163void _Thread_queue_Extract( Thread_Control *the_thread )
    163164{
    164   ISR_lock_Context      lock_context;
    165   ISR_lock_Control     *lock;
    166   Thread_queue_Control *the_thread_queue;
     165  ISR_lock_Context    lock_context;
     166  ISR_lock_Control   *lock;
     167  Thread_queue_Queue *queue;
    167168
    168169  lock = _Thread_Lock_acquire( the_thread, &lock_context );
    169170
    170   the_thread_queue = the_thread->Wait.queue;
    171 
    172   if ( the_thread_queue != NULL ) {
    173     _SMP_Assert( lock == &the_thread_queue->Lock );
    174 
    175     _Thread_queue_Extract_critical( the_thread_queue, the_thread, &lock_context );
     171  queue = the_thread->Wait.queue;
     172
     173  if ( queue != NULL ) {
     174    _SMP_Assert( lock == &queue->Lock );
     175
     176    _Thread_queue_Extract_critical(
     177      queue,
     178      the_thread->Wait.operations,
     179      the_thread,
     180      &lock_context
     181    );
    176182  } else {
    177183    _Thread_Lock_release( lock, &lock_context );
     
    189195
    190196  if ( the_thread != NULL ) {
    191     _SMP_Assert( the_thread->Lock.current == &the_thread_queue->Lock );
    192 
    193     _Thread_queue_Extract_critical( the_thread_queue, the_thread, &lock_context );
     197    _SMP_Assert( the_thread->Lock.current == &the_thread_queue->Queue.Lock );
     198
     199    _Thread_queue_Extract_critical(
     200      &the_thread_queue->Queue,
     201      the_thread_queue->operations,
     202      the_thread,
     203      &lock_context
     204    );
    194205  } else {
    195206    _Thread_queue_Release( the_thread_queue, &lock_context );
  • cpukit/score/src/threadqflush.c

    r579f16ef re273501  
    4444
    4545    _Thread_queue_Extract_critical(
    46       the_thread_queue,
     46      &the_thread_queue->Queue,
     47      the_thread_queue->operations,
    4748      the_thread,
    4849      &lock_context
  • cpukit/score/src/threadqops.c

    r579f16ef re273501  
    2222
    2323static void _Thread_queue_Do_nothing_priority_change(
    24   Thread_Control       *the_thread,
    25   Priority_Control      new_priority,
    26   Thread_queue_Control *the_thread_queue
     24  Thread_Control     *the_thread,
     25  Priority_Control    new_priority,
     26  Thread_queue_Queue *queue
    2727)
    2828{
     
    3131
    3232static void _Thread_queue_Do_nothing_extract(
    33   Thread_queue_Control *the_thread_queue,
    34   Thread_Control       *the_thread
     33  Thread_queue_Queue *queue,
     34  Thread_Control    *the_thread
    3535)
    3636{
     
    3939
    4040static void _Thread_queue_FIFO_initialize(
    41   Thread_queue_Control *the_thread_queue
     41  Thread_queue_Queue *queue
    4242)
    4343{
    44   _Chain_Initialize_empty( &the_thread_queue->Queues.Fifo );
     44  _Chain_Initialize_empty( &queue->Heads.Fifo );
    4545}
    4646
    4747static void _Thread_queue_FIFO_enqueue(
    48   Thread_queue_Control *the_thread_queue,
    49   Thread_Control       *the_thread
     48  Thread_queue_Queue *queue,
     49  Thread_Control     *the_thread
    5050)
    5151{
    5252  _Chain_Append_unprotected(
    53     &the_thread_queue->Queues.Fifo,
     53    &queue->Heads.Fifo,
    5454    &the_thread->Wait.Node.Chain
    5555  );
     
    5757
    5858static void _Thread_queue_FIFO_extract(
    59   Thread_queue_Control *the_thread_queue,
    60   Thread_Control       *the_thread
     59  Thread_queue_Queue *queue,
     60  Thread_Control     *the_thread
    6161)
    6262{
     
    6565
    6666static Thread_Control *_Thread_queue_FIFO_first(
    67   Thread_queue_Control *the_thread_queue
     67  Thread_queue_Queue *queue
    6868)
    6969{
    70   Chain_Control *fifo = &the_thread_queue->Queues.Fifo;
     70  Chain_Control *fifo = &queue->Heads.Fifo;
    7171
    7272  return _Chain_Is_empty( fifo ) ?
     
    7575
    7676static void _Thread_queue_Priority_priority_change(
    77   Thread_Control       *the_thread,
    78   Priority_Control      new_priority,
    79   Thread_queue_Control *the_thread_queue
     77  Thread_Control     *the_thread,
     78  Priority_Control    new_priority,
     79  Thread_queue_Queue *queue
    8080)
    8181{
    8282  _RBTree_Extract(
    83     &the_thread_queue->Queues.Priority,
     83    &queue->Heads.Priority,
    8484    &the_thread->Wait.Node.RBTree
    8585  );
    8686  _RBTree_Insert(
    87     &the_thread_queue->Queues.Priority,
     87    &queue->Heads.Priority,
    8888    &the_thread->Wait.Node.RBTree,
    8989    _Thread_queue_Compare_priority,
     
    9393
    9494static void _Thread_queue_Priority_initialize(
    95   Thread_queue_Control *the_thread_queue
     95  Thread_queue_Queue *queue
    9696)
    9797{
    98   _RBTree_Initialize_empty( &the_thread_queue->Queues.Priority );
     98  _RBTree_Initialize_empty( &queue->Heads.Priority );
    9999}
    100100
    101101static void _Thread_queue_Priority_enqueue(
    102   Thread_queue_Control *the_thread_queue,
    103   Thread_Control       *the_thread
     102  Thread_queue_Queue *queue,
     103  Thread_Control     *the_thread
    104104)
    105105{
    106106  _RBTree_Insert(
    107     &the_thread_queue->Queues.Priority,
     107    &queue->Heads.Priority,
    108108    &the_thread->Wait.Node.RBTree,
    109109    _Thread_queue_Compare_priority,
     
    113113
    114114static void _Thread_queue_Priority_extract(
    115   Thread_queue_Control *the_thread_queue,
    116   Thread_Control       *the_thread
     115  Thread_queue_Queue *queue,
     116  Thread_Control     *the_thread
    117117)
    118118{
    119119  _RBTree_Extract(
    120     &the_thread_queue->Queues.Priority,
     120    &queue->Heads.Priority,
    121121    &the_thread->Wait.Node.RBTree
    122122  );
     
    124124
    125125static Thread_Control *_Thread_queue_Priority_first(
    126   Thread_queue_Control *the_thread_queue
     126  Thread_queue_Queue *queue
    127127)
    128128{
    129129  RBTree_Node *first;
    130130
    131   first = _RBTree_First( &the_thread_queue->Queues.Priority, RBT_LEFT );
     131  first = _RBTree_First( &queue->Heads.Priority, RBT_LEFT );
    132132
    133133  return first != NULL ? THREAD_RBTREE_NODE_TO_THREAD( first ) : NULL;
  • testsuites/sptests/spthreadq01/init.c

    r579f16ef re273501  
    3737  /* is there more to check? */
    3838
    39   rtems_test_assert( _Chain_Is_empty( &fifo_queue.Queues.Fifo ) );
     39  rtems_test_assert( _Chain_Is_empty( &fifo_queue.Queue.Heads.Fifo ) );
    4040  rtems_test_assert( fifo_queue.operations == &_Thread_queue_Operations_FIFO );
    4141
    42   rtems_test_assert( _RBTree_Is_empty( &fifo_queue.Queues.Priority ) );
     42  rtems_test_assert( _RBTree_Is_empty( &fifo_queue.Queue.Heads.Priority ) );
    4343  rtems_test_assert(
    4444    prio_queue.operations == &_Thread_queue_Operations_priority
Note: See TracChangeset for help on using the changeset viewer.