Changeset 0bb4dd03 in rtems


Ignore:
Timestamp:
09/01/05 16:31:22 (19 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Children:
58cfecc
Parents:
feedcdc
Message:

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

PR 820/rtems

  • inline/rtems/score/coremsg.inl, macros/rtems/score/coremsg.inl, 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/score
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/ChangeLog

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

    rfeedcdc r0bb4dd03  
    183183/*PAGE
    184184 *
    185  *  _CORE_message_queue_Append
     185 *  _CORE_message_queue_Append_unprotected
    186186 *
    187187 *  DESCRIPTION:
     
    191191 */
    192192
    193 RTEMS_INLINE_ROUTINE void _CORE_message_queue_Append (
     193RTEMS_INLINE_ROUTINE void _CORE_message_queue_Append_unprotected (
    194194  CORE_message_queue_Control        *the_message_queue,
    195195  CORE_message_queue_Buffer_control *the_message
    196196)
    197197{
    198   _Chain_Append( &the_message_queue->Pending_messages, &the_message->Node );
    199 }
    200 
    201 /*PAGE
    202  *
    203  *  _CORE_message_queue_Prepend
     198  _Chain_Append_unprotected(
     199    &the_message_queue->Pending_messages,
     200    &the_message->Node
     201  );
     202}
     203
     204/*PAGE
     205 *
     206 *  _CORE_message_queue_Prepend_unprotected
    204207 *
    205208 *  DESCRIPTION:
     
    209212 */
    210213
    211 RTEMS_INLINE_ROUTINE void _CORE_message_queue_Prepend (
     214RTEMS_INLINE_ROUTINE void _CORE_message_queue_Prepend_unprotected (
    212215  CORE_message_queue_Control        *the_message_queue,
    213216  CORE_message_queue_Buffer_control *the_message
    214217)
    215218{
    216   _Chain_Prepend(
     219  _Chain_Prepend_unprotected(
    217220    &the_message_queue->Pending_messages,
    218221    &the_message->Node
  • cpukit/score/macros/rtems/score/coremsg.inl

    rfeedcdc r0bb4dd03  
    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

    rfeedcdc r0bb4dd03  
    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 *
     
    5555)
    5656{
    57   the_message_queue->number_of_pending_messages += 1;
     57  ISR_Level  level;
     58  boolean    notify = FALSE;
    5859
    5960  the_message->priority = submit_type;
     
    6162  switch ( submit_type ) {
    6263    case CORE_MESSAGE_QUEUE_SEND_REQUEST:
    63       _CORE_message_queue_Append( the_message_queue, the_message );
     64      _ISR_Disable( level );
     65        if ( the_message_queue->number_of_pending_messages++ == 0 )
     66          notify = TRUE;
     67        _CORE_message_queue_Append_unprotected(the_message_queue, the_message);
     68      _ISR_Enable( level );
    6469      break;
    6570    case CORE_MESSAGE_QUEUE_URGENT_REQUEST:
    66       _CORE_message_queue_Prepend( the_message_queue, the_message );
     71      _ISR_Disable( level );
     72        if ( the_message_queue->number_of_pending_messages++ == 0 )
     73          notify = TRUE;
     74        _CORE_message_queue_Prepend_unprotected(the_message_queue, the_message);
     75      _ISR_Enable( level );
    6776      break;
    6877    default:
    69       /* XXX interrupt critical section needs to be addressed */
    7078      {
    7179        CORE_message_queue_Buffer_control *this_message;
     
    8694          break;
    8795        }
    88         _Chain_Insert( the_node->previous, &the_message->Node );
     96        _ISR_Disable( level );
     97          if ( the_message_queue->number_of_pending_messages++ == 0 )
     98            notify = TRUE;
     99          _Chain_Insert_unprotected( the_node->previous, &the_message->Node );
     100        _ISR_Enable( level );
    89101      }
    90102      break;
     
    97109   */
    98110
    99   if ( the_message_queue->number_of_pending_messages == 1 &&
    100        the_message_queue->notify_handler )
     111  if ( notify && the_message_queue->notify_handler )
    101112    (*the_message_queue->notify_handler)( the_message_queue->notify_argument );
    102113}
Note: See TracChangeset for help on using the changeset viewer.