Changeset 2bbe78a2 in rtems


Ignore:
Timestamp:
Sep 1, 2005, 4:32:06 PM (16 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
fe7541a2
Parents:
a98ea87
Message:

2005-09-01 Joel Sherrill <joel@…>

PR 820/rtems

  • score/inline/rtems/score/coremsg.inl, score/macros/rtems/score/coremsg.inl, score/src/coremsginsert.c: Increment of pending message count should be atomic with insertion on the pending message chain. Determination of the need to call the notification handler should also be in this atomic section of code.
Location:
cpukit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    ra98ea87 r2bbe78a2  
     12005-09-01      Joel Sherrill <joel@OARcorp.com>
     2
     3        PR 820/rtems
     4        * score/inline/rtems/score/coremsg.inl,
     5        score/macros/rtems/score/coremsg.inl, score/src/coremsginsert.c:
     6        Increment of pending message count should be atomic with insertion on
     7        the pending message chain. Determination of the need to call the
     8        notification handler should also be in this atomic section of code.
     9
    1102005-09-01      Joel Sherrill <joel@OARcorp.com>
    211
  • cpukit/score/inline/rtems/score/coremsg.inl

    ra98ea87 r2bbe78a2  
    159159 */
    160160
    161 RTEMS_INLINE_ROUTINE void _CORE_message_queue_Append (
     161RTEMS_INLINE_ROUTINE void _CORE_message_queue_Append_unprotected (
    162162  CORE_message_queue_Control        *the_message_queue,
    163163  CORE_message_queue_Buffer_control *the_message
    164164)
    165165{
    166   _Chain_Append( &the_message_queue->Pending_messages, &the_message->Node );
     166  _Chain_Append_unprotected(
     167    &the_message_queue->Pending_messages,
     168    &the_message->Node
     169  );
    167170}
    168171
     
    172175 */
    173176
    174 RTEMS_INLINE_ROUTINE void _CORE_message_queue_Prepend (
     177RTEMS_INLINE_ROUTINE void _CORE_message_queue_Prepend_unprotected (
    175178  CORE_message_queue_Control        *the_message_queue,
    176179  CORE_message_queue_Buffer_control *the_message
    177180)
    178181{
    179   _Chain_Prepend(
     182  _Chain_Prepend_unprotected(
    180183    &the_message_queue->Pending_messages,
    181184    &the_message->Node
  • cpukit/score/macros/rtems/score/coremsg.inl

    ra98ea87 r2bbe78a2  
    9898 */
    9999
    100 #define _CORE_message_queue_Append( _the_message_queue, _the_message ) \
    101    _Chain_Append( &(_the_message_queue)->Pending_messages, \
     100#define _CORE_message_queue_Append_unprotected( \
     101          _the_message_queue, _the_message ) \
     102   _Chain_Append_unprotected( &(_the_message_queue)->Pending_messages, \
    102103                  &(_the_message)->Node )
    103104
     
    108109 */
    109110
    110 #define _CORE_message_queue_Prepend( _the_message_queue, _the_message ) \
    111    _Chain_Prepend( &(_the_message_queue)->Pending_messages, \
     111#define _CORE_message_queue_Prepend_unprotected( \
     112          _the_message_queue, _the_message ) \
     113   _Chain_Prepend_unprotected( &(_the_message_queue)->Pending_messages, \
    112114                   &(_the_message)->Node )
    113115
  • cpukit/score/src/coremsginsert.c

    ra98ea87 r2bbe78a2  
    88 *  via messages passed to queue objects.
    99 *
    10  *  COPYRIGHT (c) 1989-1999.
     10 *  COPYRIGHT (c) 1989-2005.
    1111 *  On-Line Applications Research Corporation (OAR).
    1212 *
     
    5959)
    6060{
    61   the_message_queue->number_of_pending_messages += 1;
     61  ISR_Level  level;
     62  boolean    notify = FALSE;
    6263
    6364  the_message->priority = submit_type;
     
    6566  switch ( submit_type ) {
    6667    case CORE_MESSAGE_QUEUE_SEND_REQUEST:
    67       _CORE_message_queue_Append( the_message_queue, the_message );
     68      _ISR_Disable( level );
     69        if ( the_message_queue->number_of_pending_messages++ == 0 )
     70          notify = TRUE;
     71        _CORE_message_queue_Append_unprotected(the_message_queue, the_message);
     72      _ISR_Enable( level );
    6873      break;
    6974    case CORE_MESSAGE_QUEUE_URGENT_REQUEST:
    70       _CORE_message_queue_Prepend( the_message_queue, the_message );
     75      _ISR_Disable( level );
     76        if ( the_message_queue->number_of_pending_messages++ == 0 )
     77          notify = TRUE;
     78        _CORE_message_queue_Prepend_unprotected(the_message_queue, the_message);
     79      _ISR_Enable( level );
    7180      break;
    7281    default:
    73       /* XXX interrupt critical section needs to be addressed */
    7482      {
    7583        CORE_message_queue_Buffer_control *this_message;
     
    9098          break;
    9199        }
    92         _Chain_Insert( the_node->previous, &the_message->Node );
     100        _ISR_Disable( level );
     101          if ( the_message_queue->number_of_pending_messages++ == 0 )
     102            notify = TRUE;
     103          _Chain_Insert_unprotected( the_node->previous, &the_message->Node );
     104        _ISR_Enable( level );
    93105      }
    94106      break;
     
    101113   */
    102114
    103   if ( the_message_queue->number_of_pending_messages == 1 &&
    104        the_message_queue->notify_handler )
     115  if ( notify && the_message_queue->notify_handler )
    105116    (*the_message_queue->notify_handler)( the_message_queue->notify_argument );
    106117}
Note: See TracChangeset for help on using the changeset viewer.