source: rtems/testsuites/mptests/mp13/task1.c @ 03f2154e

4.104.114.84.95
Last change on this file since 03f2154e was 03f2154e, checked in by Joel Sherrill <joel.sherrill@…>, on 04/22/97 at 17:20:27

headers updated to reflect new style copyright notice as part
of switching to the modified GNU GPL.

  • Property mode set to 100644
File size: 1.9 KB
Line 
1/*  Test_task1
2 *
3 *  This task attempts to receive a message from a global message queue.
4 *  If running on the node on which the queue resides, the wait is
5 *  forever, otherwise it times out on a remote message queue.
6 *
7 *  Input parameters:
8 *    argument - task argument
9 *
10 *  Output parameters:  NONE
11 *
12 *  COPYRIGHT (c) 1989-1997.
13 *  On-Line Applications Research Corporation (OAR).
14 *  Copyright assigned to U.S. Government, 1994.
15 *
16 *  The license and distribution terms for this file may in
17 *  the file LICENSE in this distribution or at
18 *  http://www.OARcorp.com/rtems/license.html.
19 *
20 *  $Id$
21 */
22
23#include "system.h"
24
25rtems_task Test_task1(
26  rtems_task_argument argument
27)
28{
29  char              receive_buffer[16];
30  rtems_unsigned32  size;
31  rtems_status_code status;
32
33  puts( "Getting QID of message queue" );
34
35  do {
36    status = rtems_message_queue_ident(
37      Queue_name[ 1 ],
38      RTEMS_SEARCH_ALL_NODES,
39      &Queue_id[ 1 ]
40    );
41  } while ( !rtems_is_status_successful( status ) );
42
43  if ( Multiprocessing_configuration.node == 1 ) {
44    puts( "Receiving message ..." );
45    status = rtems_message_queue_receive(
46      Queue_id[ 1 ],
47      (long (*)[4])receive_buffer,
48      &size,
49      RTEMS_DEFAULT_OPTIONS,
50      RTEMS_NO_TIMEOUT
51    );
52    puts( "How did I get back from here????" );
53    directive_failed( status, "rtems_message_queue_receive" );
54  }
55
56  status = rtems_task_wake_after( TICKS_PER_SECOND );
57  directive_failed( status, "rtems_task_wake_after" );
58
59  puts( "Receiving message ..." );
60  status = rtems_message_queue_receive(
61    Queue_id[ 1 ],
62    (long (*)[4])receive_buffer,
63    &size,
64    RTEMS_DEFAULT_OPTIONS,
65    2 * TICKS_PER_SECOND
66  );
67  fatal_directive_status(status, RTEMS_TIMEOUT, "rtems_message_queue_receive");
68  puts( "rtems_message_queue_receive correctly returned RTEMS_TIMEOUT" );
69
70  puts( "Deleting self" );
71  status = rtems_task_delete( RTEMS_SELF );
72  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
73}
Note: See TracBrowser for help on using the repository browser.