source: rtems/c/src/exec/rtems/src/msgqreceive.c @ 28adcfd

4.104.114.84.95
Last change on this file since 28adcfd was 28adcfd, checked in by Joel Sherrill <joel.sherrill@…>, on 01/05/00 at 22:14:09

Added message priority parameter returned by core support routine.

  • Property mode set to 100644
File size: 2.6 KB
Line 
1/*
2 *  Message Queue Manager
3 *
4 *
5 *  COPYRIGHT (c) 1989-1999.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.OARcorp.com/rtems/license.html.
11 *
12 *  $Id$
13 */
14
15#include <rtems/system.h>
16#include <rtems/score/sysstate.h>
17#include <rtems/score/chain.h>
18#include <rtems/score/isr.h>
19#include <rtems/score/coremsg.h>
20#include <rtems/score/object.h>
21#include <rtems/score/states.h>
22#include <rtems/score/thread.h>
23#include <rtems/score/wkspace.h>
24#if defined(RTEMS_MULTIPROCESSING)
25#include <rtems/score/mpci.h>
26#endif
27#include <rtems/rtems/status.h>
28#include <rtems/rtems/attr.h>
29#include <rtems/rtems/message.h>
30#include <rtems/rtems/options.h>
31#include <rtems/rtems/support.h>
32
33/*PAGE
34 *
35 *  rtems_message_queue_receive
36 *
37 *  This directive dequeues a message from the designated message queue
38 *  and copies it into the requesting thread's buffer.
39 *
40 *  Input parameters:
41 *    id         - queue id
42 *    buffer     - pointer to message buffer
43 *    size       - size of message receive
44 *    option_set - options on receive
45 *    timeout    - number of ticks to wait
46 *
47 *  Output parameters:
48 *    RTEMS_SUCCESSFUL - if successful
49 *    error code       - if unsuccessful
50 */
51
52rtems_status_code rtems_message_queue_receive(
53  Objects_Id            id,
54  void                 *buffer,
55  unsigned32           *size,
56  unsigned32            option_set,
57  rtems_interval        timeout
58)
59{
60  register Message_queue_Control *the_message_queue;
61  Objects_Locations               location;
62  boolean                         wait;
63  CORE_message_queue_Submit_types core_priority;
64 
65  the_message_queue = _Message_queue_Get( id, &location );
66  switch ( location ) {
67
68    case OBJECTS_REMOTE:
69#if defined(RTEMS_MULTIPROCESSING)
70      return _Message_queue_MP_Send_request_packet(
71          MESSAGE_QUEUE_MP_RECEIVE_REQUEST,
72          id,
73          buffer,
74          size,
75          option_set,
76          timeout
77        );
78#endif
79
80    case OBJECTS_ERROR:
81      return RTEMS_INVALID_ID;
82
83    case OBJECTS_LOCAL:
84      if ( _Options_Is_no_wait( option_set ) )
85        wait = FALSE;
86      else
87        wait = TRUE;
88 
89      _CORE_message_queue_Seize(
90        &the_message_queue->message_queue,
91        the_message_queue->Object.id,
92        buffer,
93        size,
94        wait,
95        &core_priority,
96        timeout
97      );
98      _Thread_Enable_dispatch();
99      return( _Message_queue_Translate_core_message_queue_return_code(
100                  _Thread_Executing->Wait.return_code ) );
101
102  }
103
104  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
105}
Note: See TracBrowser for help on using the repository browser.