Changeset 1c1e31f7 in rtems


Ignore:
Timestamp:
Aug 4, 2016, 6:10:29 AM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
6117f29
Parents:
21bdca4
Message:

score: Optimize _Thread_queue_Path_release()

Update #2556.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/src/threadqenqueue.c

    r21bdca4 r1c1e31f7  
    163163#endif
    164164
     165#define THREAD_QUEUE_LINK_OF_PATH_NODE( node ) \
     166  RTEMS_CONTAINER_OF( node, Thread_queue_Link, Path_node );
     167
    165168static void _Thread_queue_Path_release( Thread_queue_Path *path )
    166169{
     
    172175  node = _Chain_Last( &path->Links );
    173176
    174   while ( head != node ) {
     177  if ( head != node ) {
    175178    Thread_queue_Link *link;
    176179
    177     link = RTEMS_CONTAINER_OF( node, Thread_queue_Link, Path_node );
    178 
    179     if ( link->Queue_context.Wait.queue != NULL ) {
    180       _Thread_queue_Link_remove( link );
    181     }
    182 
    183     _Thread_Wait_release_critical( link->owner, &link->Queue_context );
     180    /* The terminal link has an owner which does not wait on a thread queue */
     181    link = THREAD_QUEUE_LINK_OF_PATH_NODE( node );
     182    _Assert( link->Queue_context.Wait.queue == NULL );
     183
     184    _Thread_Wait_release_default_critical(
     185      link->owner,
     186      &link->Queue_context.Lock_context
     187    );
    184188
    185189    node = _Chain_Previous( node );
     
    187191    _Chain_Set_off_chain( &link->Path_node );
    188192#endif
     193
     194    while ( head != node ) {
     195      /* The other links have an owner which waits on a thread queue */
     196      link = THREAD_QUEUE_LINK_OF_PATH_NODE( node );
     197      _Assert( link->Queue_context.Wait.queue != NULL );
     198
     199      _Thread_queue_Link_remove( link );
     200      _Thread_Wait_release_queue_critical(
     201        link->Queue_context.Wait.queue,
     202        &link->Queue_context
     203      );
     204      _Thread_Wait_remove_request( link->owner, &link->Queue_context );
     205
     206      node = _Chain_Previous( node );
     207#if defined(RTEMS_DEBUG)
     208      _Chain_Set_off_chain( &link->Path_node );
     209#endif
     210    }
    189211  }
    190212#else
Note: See TracChangeset for help on using the changeset viewer.