Changeset 6741d30a in rtems


Ignore:
Timestamp:
Apr 27, 2016, 4:49:59 AM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
c8982e5
Parents:
7e66865e
git-author:
Sebastian Huber <sebastian.huber@…> (04/27/16 04:49:59)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/02/16 05:46:15)
Message:

rtems: Avoid Giant lock for message queues

Update #2555.

Location:
cpukit/rtems
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/rtems/include/rtems/rtems/messageimpl.h

    r7e66865e r6741d30a  
    102102}
    103103
    104 /**
    105  *  @brief Maps message queue IDs to message queue control blocks.
    106  *
    107  *  This function maps message queue IDs to message queue control
    108  *  blocks.  If ID corresponds to a local message queue, then it
    109  *  returns the_message_queue control pointer which maps to ID
    110  *  and location is set to OBJECTS_LOCAL.  If the message queue ID is
    111  *  global and resides on a remote node, then location is set
    112  *  to OBJECTS_REMOTE, and the_message_queue is undefined.
    113  *  Otherwise, location is set to OBJECTS_ERROR and
    114  *  the_message_queue is undefined.
    115  */
    116 RTEMS_INLINE_ROUTINE Message_queue_Control *_Message_queue_Get (
    117   Objects_Id         id,
    118   Objects_Locations *location
    119 )
    120 {
    121   return (Message_queue_Control *)
    122      _Objects_Get( &_Message_queue_Information, id, location );
    123 }
    124 
    125104RTEMS_INLINE_ROUTINE Message_queue_Control *
    126105_Message_queue_Get_interrupt_disable(
  • cpukit/rtems/src/msgqgetnumberpending.c

    r7e66865e r6741d30a  
    1919#endif
    2020
    21 #include <rtems/system.h>
    22 #include <rtems/score/chain.h>
    23 #include <rtems/score/isr.h>
    24 #include <rtems/score/coremsgimpl.h>
    25 #include <rtems/score/thread.h>
    26 #include <rtems/score/wkspace.h>
    27 #include <rtems/rtems/status.h>
    28 #include <rtems/rtems/attrimpl.h>
    2921#include <rtems/rtems/messageimpl.h>
    30 #include <rtems/rtems/options.h>
    31 #include <rtems/rtems/support.h>
    32 
    33 /*
    34  *  rtems_message_queue_get_number_pending
    35  *
    36  *  This directive returns the number of messages pending.
    37  *
    38  *  Input parameters:
    39  *    id    - queue id
    40  *    count - return area for count
    41  *
    42  *  Output parameters:
    43  *    count             - number of messages removed ( 0 = empty queue )
    44  *    RTEMS_SUCCESSFUL - if successful
    45  *    error code        - if unsuccessful
    46  */
    4722
    4823rtems_status_code rtems_message_queue_get_number_pending(
     
    5126)
    5227{
    53   Message_queue_Control          *the_message_queue;
    54   Objects_Locations               location;
     28  Message_queue_Control *the_message_queue;
     29  Objects_Locations      location;
     30  ISR_lock_Context       lock_context;
    5531
    5632  if ( !count )
    5733    return RTEMS_INVALID_ADDRESS;
    5834
    59   the_message_queue = _Message_queue_Get( id, &location );
     35  the_message_queue = _Message_queue_Get_interrupt_disable(
     36    id,
     37    &location,
     38    &lock_context
     39  );
    6040  switch ( location ) {
    6141
    6242    case OBJECTS_LOCAL:
     43      _CORE_message_queue_Acquire_critical(
     44        &the_message_queue->message_queue,
     45        &lock_context
     46      );
    6347      *count = the_message_queue->message_queue.number_of_pending_messages;
    64       _Objects_Put( &the_message_queue->Object );
     48      _CORE_message_queue_Release(
     49        &the_message_queue->message_queue,
     50        &lock_context
     51      );
    6552      return RTEMS_SUCCESSFUL;
    6653
    6754#if defined(RTEMS_MULTIPROCESSING)
    6855    case OBJECTS_REMOTE:
    69       _Thread_Executing->Wait.return_argument = count;
     56      _Thread_Get_executing()->Wait.return_argument = count;
    7057
    7158      return _Message_queue_MP_Send_request_packet(
Note: See TracChangeset for help on using the changeset viewer.