source: rtems/c/src/exec/itron/src/ref_mbx.c @ 5e96e917

4.104.114.84.95
Last change on this file since 5e96e917 was 5e96e917, checked in by Joel Sherrill <joel.sherrill@…>, on 11/17/99 at 15:24:11

Updated Mailbox Manager submitted and split into multiple files.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 *  ITRON 3.0 Mailbox Manager
3 *
4 *  The license and distribution terms for this file may be
5 *  found in the file LICENSE in this distribution or at
6 *  http://www.OARcorp.com/rtems/license.html.
7 *
8 *  $Id$
9 */
10
11#include <itron.h>
12
13#include <rtems/itron/mbox.h>
14#include <rtems/itron/task.h>
15
16/*
17 *  ref_mbx - Reference Mailbox Status
18 */
19
20ER ref_mbx(
21  T_RMBX *pk_rmbx,
22  ID      mbxid
23)
24{
25  register ITRON_Mailbox_Control *the_mailbox;
26  Objects_Locations               location;
27  Chain_Control                  *pending;
28
29  if ( !pk_rmbx )
30    return E_PAR;
31
32  the_mailbox = _ITRON_Mailbox_Get( mbxid, &location );
33  switch ( location ) {
34    case OBJECTS_REMOTE:
35    case OBJECTS_ERROR:
36      return _ITRON_Mailbox_Clarify_get_id_error( mbxid );
37
38    case OBJECTS_LOCAL:
39
40      pending = &the_mailbox->message_queue.Pending_messages;
41      if ( _Chain_Is_empty( pending ) )
42        pk_rmbx->pk_msg = NULL;
43      else
44        pk_rmbx->pk_msg = (T_MSG *) pending->first;
45
46      /*
47       *  Fill in whether or not there is a waiting task
48       */
49
50      if ( !_Thread_queue_First( &the_mailbox->message_queue.Wait_queue ) )
51        pk_rmbx->wtsk = FALSE;
52      else
53        pk_rmbx->wtsk = TRUE;
54
55      break;
56  }
57  _ITRON_return_errorno( E_OK );
58}
59
Note: See TracBrowser for help on using the repository browser.