コード例 #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
static void _Scheduler_simple_smp_Insert(
  Chain_Control *chain,
  Thread_Control *thread,
  Chain_Node_order order
)
{
  _Chain_Insert_ordered_unprotected( chain, &thread->Object.Node, order );
}
コード例 #3
0
ファイル: schedulersimplesmp.c プロジェクト: Fyleo/rtems
static void _Scheduler_simple_SMP_Insert_ready_fifo(
  Scheduler_Context *context,
  Thread_Control *thread
)
{
  Scheduler_simple_SMP_Context *self =
    _Scheduler_simple_SMP_Get_self( context );

  _Chain_Insert_ordered_unprotected(
    &self->Ready,
    &thread->Object.Node,
    _Scheduler_simple_Insert_priority_fifo_order
  );
}
コード例 #4
0
ファイル: coremsginsert.c プロジェクト: Avanznow/rtems
void _CORE_message_queue_Insert_message(
  CORE_message_queue_Control        *the_message_queue,
  CORE_message_queue_Buffer_control *the_message,
  CORE_message_queue_Submit_types    submit_type
)
{
  Chain_Control *pending_messages;
#if defined(RTEMS_SCORE_COREMSG_ENABLE_NOTIFICATION)
  bool           notify;
#endif

  _CORE_message_queue_Set_message_priority( the_message, submit_type );
  pending_messages = &the_message_queue->Pending_messages;

#if defined(RTEMS_SCORE_COREMSG_ENABLE_NOTIFICATION)
  notify = ( the_message_queue->number_of_pending_messages == 0 );
#endif
  ++the_message_queue->number_of_pending_messages;

  if ( submit_type == CORE_MESSAGE_QUEUE_SEND_REQUEST ) {
    _Chain_Append_unprotected( pending_messages, &the_message->Node );
#if defined(RTEMS_SCORE_COREMSG_ENABLE_MESSAGE_PRIORITY)
  } else  if ( submit_type != CORE_MESSAGE_QUEUE_URGENT_REQUEST ) {
    _Chain_Insert_ordered_unprotected(
      pending_messages,
      &the_message->Node,
      _CORE_message_queue_Order
    );
#endif
  } else {
    _Chain_Prepend_unprotected( pending_messages, &the_message->Node );
  }

  #if defined(RTEMS_SCORE_COREMSG_ENABLE_NOTIFICATION)
    /*
     *  According to POSIX, does this happen before or after the message
     *  is actually enqueued.  It is logical to think afterwards, because
     *  the message is actually in the queue at this point.
     */
    if ( notify && the_message_queue->notify_handler )
      (*the_message_queue->notify_handler)(the_message_queue->notify_argument);
  #endif
}