source: rtems/c/src/exec/itron/src/ref_mbx.c @ 9d9a3dd

4.104.114.84.95
Last change on this file since 9d9a3dd was 9d9a3dd, checked in by Jennifer Averett <Jennifer.Averett@…>, on 11/17/99 at 16:47:58

+ Updated copyright information.

  • Property mode set to 100644
File size: 1.3 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 *  ref_mbx - Reference Mailbox Status
21 */
22
23ER ref_mbx(
24  T_RMBX *pk_rmbx,
25  ID      mbxid
26)
27{
28  register ITRON_Mailbox_Control *the_mailbox;
29  Objects_Locations               location;
30  Chain_Control                  *pending;
31
32  if ( !pk_rmbx )
33    return E_PAR;
34
35  the_mailbox = _ITRON_Mailbox_Get( mbxid, &location );
36  switch ( location ) {
37    case OBJECTS_REMOTE:
38    case OBJECTS_ERROR:
39      return _ITRON_Mailbox_Clarify_get_id_error( mbxid );
40
41    case OBJECTS_LOCAL:
42
43      pending = &the_mailbox->message_queue.Pending_messages;
44      if ( _Chain_Is_empty( pending ) )
45        pk_rmbx->pk_msg = NULL;
46      else
47        pk_rmbx->pk_msg = (T_MSG *) pending->first;
48
49      /*
50       *  Fill in whether or not there is a waiting task
51       */
52
53      if ( !_Thread_queue_First( &the_mailbox->message_queue.Wait_queue ) )
54        pk_rmbx->wtsk = FALSE;
55      else
56        pk_rmbx->wtsk = TRUE;
57
58      break;
59  }
60  _ITRON_return_errorno( E_OK );
61}
62
Note: See TracBrowser for help on using the repository browser.