source: rtems/cpukit/itron/src/snd_mbx.c @ 4bf1801

4.104.114.84.95
Last change on this file since 4bf1801 was 53fb837a, checked in by Joel Sherrill <joel.sherrill@…>, on 01/13/00 at 19:25:15

POSIX message queues now include complete functionality including
blocking sends when the queue is full. The SuperCore? was enhanced
to support blocking on send. The existing POSIX API was debugged
and numerous test cases were added to psxmsgq01 by Jennifer Averett.
SuperCore? enhancements and resulting modifications to other APIs
were done by Joel.

There is one significant point of interpretation for the POSIX API.
What happens to threads already blocked on a message queue when the
mode of that same message queue is changed from blocking to non-blocking?
We decided to unblock all waiting tasks with an EAGAIN error just
as if a non-blocking version of the same operation had returned
unsatisfied. This case is not discussed in the POSIX standard and
other implementations may have chosen differently.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  ITRON 3.0 Mailbox Manager
3 *
4 *  COPYRIGHT (c) 1989-1999.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.OARcorp.com/rtems/license.html.
10 *
11 *  $Id$
12 */
13
14#include <itron.h>
15
16#include <rtems/itron/mbox.h>
17#include <rtems/itron/task.h>
18
19/*
20 *  snd_msg - Send Message to Mailbox
21 */
22
23ER snd_msg(
24  ID     mbxid,
25  T_MSG *pk_msg
26)
27{
28  register ITRON_Mailbox_Control *the_mailbox;
29  Objects_Locations                location;
30  unsigned32                       message_priority;
31  void                            *message_contents;
32
33  if ( !pk_msg )
34    return E_PAR;
35
36  the_mailbox = _ITRON_Mailbox_Get( mbxid, &location );
37  switch ( location ) {
38    case OBJECTS_REMOTE:
39    case OBJECTS_ERROR:
40      return _ITRON_Mailbox_Clarify_get_id_error( mbxid );
41
42    case OBJECTS_LOCAL:
43      if ( the_mailbox->do_message_priority )
44        message_priority = pk_msg->msgpri;
45      else
46        message_priority = CORE_MESSAGE_QUEUE_SEND_REQUEST;
47
48      message_contents = pk_msg;
49      _CORE_message_queue_Submit(
50        &the_mailbox->message_queue,
51        &message_contents,
52        sizeof(T_MSG *),
53        the_mailbox->Object.id,
54        NULL,          /* multiprocessing not supported */
55        message_priority,
56        FALSE,     /* do not allow sender to block */
57        0          /* no timeout */
58     );
59     break;
60  }
61
62  _ITRON_return_errorno(
63     _ITRON_Mailbox_Translate_core_message_queue_return_code(
64          _Thread_Executing->Wait.return_code
65     )
66  );
67}
Note: See TracBrowser for help on using the repository browser.