Changeset 507d382 in rtems for cpukit/score/src/coremsginsert.c


Ignore:
Timestamp:
Sep 11, 2009, 8:00:30 PM (11 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 5, master
Children:
5a6d25fc
Parents:
b094233
Message:

2009-09-11 Joel Sherrill <joel.sherrill@…>

  • score/include/rtems/score/coremsg.h, score/inline/rtems/score/coremsg.inl, score/src/coremsg.c, score/src/coremsginsert.c, score/src/coremsgseize.c, score/src/coremsgsubmit.c, score/src/objectnametoidstring.c: Disable the Core Message Queue features of notification, priority messages, and blocking sends when no API requires them.
File:
1 edited

Legend:

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

    rb094233 r507d382  
    5757{
    5858  ISR_Level  level;
    59   bool       notify = false;
     59  #if defined(RTEMS_SCORE_COREMSG_ENABLE_NOTIFICATION)
     60    bool    notify = false;
     61    #define SET_NOTIFY() \
     62      if ( the_message_queue->number_of_pending_messages == 0 )
     63        notify = true;
     64  #else
     65    #define SET_NOTIFY()
     66  #endif
    6067
    61   the_message->priority = submit_type;
     68  #if defined(RTEMS_SCORE_COREMSG_ENABLE_MESSAGE_PRIORITY)
     69    the_message->priority = submit_type;
     70  #endif
    6271
    63   switch ( submit_type ) {
    64     case CORE_MESSAGE_QUEUE_SEND_REQUEST:
     72  #if !defined(RTEMS_SCORE_COREMSG_ENABLE_MESSAGE_PRIORITY)
     73    _ISR_Disable( level );
     74      SET_NOTIFY();
     75      the_message_queue->number_of_pending_messages++;
     76      if ( submit_type == CORE_MESSAGE_QUEUE_SEND_REQUEST )
     77        _CORE_message_queue_Append_unprotected(the_message_queue, the_message);
     78      else
     79        _CORE_message_queue_Prepend_unprotected(the_message_queue, the_message);
     80    _ISR_Enable( level );
     81  #else
     82    if ( submit_type == CORE_MESSAGE_QUEUE_SEND_REQUEST ) {
    6583      _ISR_Disable( level );
    66         if ( the_message_queue->number_of_pending_messages++ == 0 )
    67           notify = true;
     84        SET_NOTIFY();
     85        the_message_queue->number_of_pending_messages++;
    6886        _CORE_message_queue_Append_unprotected(the_message_queue, the_message);
    6987      _ISR_Enable( level );
    70       break;
    71     case CORE_MESSAGE_QUEUE_URGENT_REQUEST:
     88    } else if ( submit_type == CORE_MESSAGE_QUEUE_URGENT_REQUEST ) {
    7289      _ISR_Disable( level );
    73         if ( the_message_queue->number_of_pending_messages++ == 0 )
    74           notify = true;
     90        SET_NOTIFY();
     91        the_message_queue->number_of_pending_messages++;
    7592        _CORE_message_queue_Prepend_unprotected(the_message_queue, the_message);
    7693      _ISR_Enable( level );
    77       break;
    78     default:
    79       {
    80         CORE_message_queue_Buffer_control *this_message;
    81         Chain_Node                        *the_node;
    82         Chain_Control                     *the_header;
     94    } else {
     95      CORE_message_queue_Buffer_control *this_message;
     96      Chain_Node                        *the_node;
     97      Chain_Control                     *the_header;
    8398
    84         the_header = &the_message_queue->Pending_messages;
    85         the_node = the_header->first;
    86         while ( !_Chain_Is_tail( the_header, the_node ) ) {
     99      the_header = &the_message_queue->Pending_messages;
     100      the_node = the_header->first;
     101      while ( !_Chain_Is_tail( the_header, the_node ) ) {
    87102
    88           this_message = (CORE_message_queue_Buffer_control *) the_node;
     103        this_message = (CORE_message_queue_Buffer_control *) the_node;
    89104
    90           if ( this_message->priority <= the_message->priority ) {
    91             the_node = the_node->next;
    92             continue;
    93           }
     105        if ( this_message->priority <= the_message->priority ) {
     106          the_node = the_node->next;
     107          continue;
     108        }
     109        break;
     110      }
     111      _ISR_Disable( level );
     112        SET_NOTIFY();
     113        the_message_queue->number_of_pending_messages++;
     114        _Chain_Insert_unprotected( the_node->previous, &the_message->Node );
     115      _ISR_Enable( level );
     116    }
     117  #endif
    94118
    95           break;
    96         }
    97         _ISR_Disable( level );
    98           if ( the_message_queue->number_of_pending_messages++ == 0 )
    99             notify = true;
    100           _Chain_Insert_unprotected( the_node->previous, &the_message->Node );
    101         _ISR_Enable( level );
    102       }
    103       break;
    104   }
    105 
    106   /*
    107    *  According to POSIX, does this happen before or after the message
    108    *  is actually enqueued.  It is logical to think afterwards, because
    109    *  the message is actually in the queue at this point.
    110    */
    111 
    112   if ( notify && the_message_queue->notify_handler )
    113     (*the_message_queue->notify_handler)( the_message_queue->notify_argument );
     119  #if defined(RTEMS_SCORE_COREMSG_ENABLE_NOTIFICATION)
     120    /*
     121     *  According to POSIX, does this happen before or after the message
     122     *  is actually enqueued.  It is logical to think afterwards, because
     123     *  the message is actually in the queue at this point.
     124     */
     125    if ( notify && the_message_queue->notify_handler )
     126      (*the_message_queue->notify_handler)(the_message_queue->notify_argument);
     127  #endif
    114128}
Note: See TracChangeset for help on using the changeset viewer.