예제 #1
0
파일: init.c 프로젝트: Avanznow/rtems
static void test_chain_insert_ordered( void )
{
  Chain_Control chain = CHAIN_INITIALIZER_EMPTY(chain);
  Chain_Node nodes[5];
  const Chain_Node *tail;
  const Chain_Node *node;
  size_t n = RTEMS_ARRAY_SIZE( nodes );
  size_t i = 0;

  puts( "INIT - Verify _Chain_Insert_ordered_unprotected" );

  _Chain_Insert_ordered_unprotected( &chain, &nodes[4], test_order );
  _Chain_Insert_ordered_unprotected( &chain, &nodes[2], test_order );
  _Chain_Insert_ordered_unprotected( &chain, &nodes[0], test_order );
  _Chain_Insert_ordered_unprotected( &chain, &nodes[3], test_order );
  _Chain_Insert_ordered_unprotected( &chain, &nodes[1], test_order );

  tail = _Chain_Immutable_tail( &chain );
  node = _Chain_Immutable_first( &chain );
  while ( node != tail && i < n ) {
    rtems_test_assert( node == &nodes[ i ] );
    ++i;
    node = _Chain_Immutable_next( node );
  }

  rtems_test_assert( i == n );
}
예제 #2
0
void _User_extensions_Iterate(
  void                    *arg,
  User_extensions_Visitor  visitor
)
{
  Thread_Control   *executing = _Thread_Executing;
  const User_extensions_Table *callouts_current =
    rtems_configuration_get_user_extension_table();
  const User_extensions_Table *callouts_end =
    callouts_current + rtems_configuration_get_number_of_initial_extensions();
  const Chain_Node *node;
  const Chain_Node *tail;

  while ( callouts_current != callouts_end ) {
    (*visitor)( executing, arg, callouts_current );

    ++callouts_current;
  }

  node = _Chain_Immutable_first( &_User_extensions_List );
  tail = _Chain_Immutable_tail( &_User_extensions_List );
  while ( node != tail ) {
    const User_extensions_Control *extension =
      (const User_extensions_Control *) node;

    (*visitor)( executing, arg, &extension->Callouts );

    node = _Chain_Immutable_next( node );
  }
}