diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1997-07-31 19:01:42 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1997-07-31 19:01:42 +0000 |
commit | e7d8b5882699d0a44ab51c5547bbcd6b21d96b52 (patch) | |
tree | f2e77cb206d68ee1d74d3c32c5ef174c58a0c902 /cpukit/rtems/src/msg.c | |
parent | Added comment to indicate what the commented out C_PIECES indicated. (diff) | |
download | rtems-e7d8b5882699d0a44ab51c5547bbcd6b21d96b52.tar.bz2 |
Added rtems_message_queue_get_number_pending directive.
Diffstat (limited to '')
-rw-r--r-- | cpukit/rtems/src/msg.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/cpukit/rtems/src/msg.c b/cpukit/rtems/src/msg.c index 37258d4faa..ea01ee67cf 100644 --- a/cpukit/rtems/src/msg.c +++ b/cpukit/rtems/src/msg.c @@ -551,6 +551,56 @@ rtems_status_code rtems_message_queue_flush( /*PAGE * + * rtems_message_queue_get_number_pending + * + * This directive returns the number of messages pending. + * + * Input parameters: + * id - queue id + * count - return area for count + * + * Output parameters: + * count - number of messages removed ( 0 = empty queue ) + * RTEMS_SUCCESSFUL - if successful + * error code - if unsuccessful + */ + +rtems_status_code rtems_message_queue_get_number_pending( + Objects_Id id, + unsigned32 *count +) +{ + register Message_queue_Control *the_message_queue; + Objects_Locations location; + + the_message_queue = _Message_queue_Get( id, &location ); + switch ( location ) { + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_REMOTE: + _Thread_Executing->Wait.return_argument = count; + + return + _Message_queue_MP_Send_request_packet( + MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_REQUEST, + id, + 0, /* buffer not used */ + 0, /* size */ + 0, /* option_set not used */ + MPCI_DEFAULT_TIMEOUT + ); + + case OBJECTS_LOCAL: + *count = the_message_queue->message_queue.number_of_pending_messages; + _Thread_Enable_dispatch(); + return RTEMS_SUCCESSFUL; + } + + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ +} + +/*PAGE + * * _Message_queue_Submit * * This routine implements the directives rtems_message_queue_send |