Example #1
0
static void _Thread_queue_Path_release( Thread_queue_Path *path )
{
#if defined(RTEMS_SMP)
  Chain_Node *head;
  Chain_Node *node;

  head = _Chain_Head( &path->Links );
  node = _Chain_Last( &path->Links );

  if ( head != node ) {
    Thread_queue_Link *link;

    /*
     * The terminal link may have an owner which does not wait on a thread
     * queue.
     */

    link = THREAD_QUEUE_LINK_OF_PATH_NODE( node );

    if ( link->Queue_context.Wait.queue == NULL ) {
      _Thread_Wait_release_default_critical(
        link->owner,
        &link->Queue_context.Lock_context
      );

      node = _Chain_Previous( node );
#if defined(RTEMS_DEBUG)
      _Chain_Set_off_chain( &link->Path_node );
#endif
    }

    while ( head != node ) {
      /* The other links have an owner which waits on a thread queue */
      link = THREAD_QUEUE_LINK_OF_PATH_NODE( node );
      _Assert( link->Queue_context.Wait.queue != NULL );

      _Thread_queue_Link_remove( link );
      _Thread_Wait_release_queue_critical(
        link->Queue_context.Wait.queue,
        &link->Queue_context
      );
      _Thread_Wait_remove_request( link->owner, &link->Queue_context );

      node = _Chain_Previous( node );
#if defined(RTEMS_DEBUG)
      _Chain_Set_off_chain( &link->Path_node );
#endif
    }
  }
#else
  (void) path;
#endif
}
Example #2
0
static
#endif
void _Thread_queue_Path_release_critical(
    Thread_queue_Context *queue_context
)
{
#if defined(RTEMS_SMP)
    Chain_Node *head;
    Chain_Node *node;

    head = _Chain_Head( &queue_context->Path.Links );
    node = _Chain_Last( &queue_context->Path.Links );

    while ( head != node ) {
        Thread_queue_Link *link;

        link = THREAD_QUEUE_LINK_OF_PATH_NODE( node );

        if ( link->Lock_context.Wait.queue != NULL ) {
            _Thread_queue_Link_remove( link );
            _Thread_Wait_release_queue_critical(
                link->Lock_context.Wait.queue,
                &link->Lock_context
            );
            _Thread_Wait_remove_request( link->owner, &link->Lock_context );
        } else {
            _Thread_Wait_release_default_critical(
                link->owner,
                &link->Lock_context.Lock_context
            );
        }

        node = _Chain_Previous( node );
#if defined(RTEMS_DEBUG)
        _Chain_Set_off_chain( &link->Path_node );
#endif
    }
#else
    (void) queue_context;
#endif
}