source: rtems/c/src/exec/itron/src/trcv_mbf.c @ 53fb837a

4.104.114.84.95
Last change on this file since 53fb837a 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.9 KB
Line 
1/*
2 *  ITRON Message Buffer 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/msgbuffer.h>
17#include <rtems/itron/task.h>
18
19/*
20 *  trcv_mbf - Receive Message from MessageBuffer with Timeout
21 */
22
23ER trcv_mbf(
24  VP   msg,
25  INT *p_msgsz,
26  ID   mbfid,
27  TMO  tmout
28)
29{
30  ITRON_Message_buffer_Control   *the_message_buffer;
31  Objects_Locations               location;
32  CORE_message_queue_Status       status;
33  boolean                         wait;
34  Watchdog_Interval               interval;
35
36  interval = 0;
37  if (tmout == TMO_POL) {
38    wait = FALSE;
39  } else {
40    wait = TRUE;
41    if (tmout != TMO_FEVR)
42      interval = TOD_MILLISECONDS_TO_TICKS(tmout);
43  }
44
45  if (wait && _ITRON_Is_in_non_task_state() )
46    return E_CTX;
47
48  if (!p_msgsz || !msg || tmout <= -2)
49    return E_PAR;
50   
51  the_message_buffer = _ITRON_Message_buffer_Get(mbfid, &location);
52  switch (location) {
53    case OBJECTS_REMOTE:
54    case OBJECTS_ERROR:           /* Multiprocessing not supported */
55      return _ITRON_Message_buffer_Clarify_get_id_error(mbfid);
56
57    case OBJECTS_LOCAL:
58      _CORE_message_queue_Seize(
59          &the_message_buffer->message_queue,
60          the_message_buffer->Object.id,
61          msg,
62          p_msgsz,
63          wait,
64          interval
65      );
66      _Thread_Enable_dispatch();
67      status = (CORE_message_queue_Status)_Thread_Executing->Wait.return_code;
68      return
69        _ITRON_Message_buffer_Translate_core_message_buffer_return_code(status);
70    }
71
72    /*
73     *  If multiprocessing were supported, this is where we would announce
74     *  the existence of the semaphore to the rest of the system.
75     */
76
77#if defined(RTEMS_MULTIPROCESSING)
78#endif
79    return E_OK;
80}
Note: See TracBrowser for help on using the repository browser.