source: rtems/testsuites/mptests/mp13/task1.c @ ac7d5ef0

4.104.114.84.95
Last change on this file since ac7d5ef0 was ac7d5ef0, checked in by Joel Sherrill <joel.sherrill@…>, on 05/11/95 at 17:39:37

Initial revision

  • Property mode set to 100644
File size: 2.0 KB
RevLine 
[ac7d5ef0]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, 1990, 1991, 1992, 1993, 1994.
13 *  On-Line Applications Research Corporation (OAR).
14 *  All rights assigned to U.S. Government, 1994.
15 *
16 *  This material may be reproduced by or for the U.S. Government pursuant
17 *  to the copyright license under the clause at DFARS 252.227-7013.  This
18 *  notice must appear in all copies of this file and its derivatives.
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_status_code status;
31
32  puts( "Getting QID of message queue" );
33
34  do {
35    status = rtems_message_queue_ident(
36      Queue_name[ 1 ],
37      RTEMS_SEARCH_ALL_NODES,
38      &Queue_id[ 1 ]
39    );
40  } while ( !rtems_is_status_successful( status ) );
41
42  if ( Multiprocessing_configuration.node == 1 ) {
43    puts( "Receiving message ..." );
44    status = rtems_message_queue_receive(
45      Queue_id[ 1 ],
46      (long (*)[4])receive_buffer,
47      RTEMS_DEFAULT_OPTIONS,
48      RTEMS_NO_TIMEOUT
49    );
50    puts( "How did I get back from here????" );
51    directive_failed( status, "rtems_message_queue_receive" );
52  }
53
54  status = rtems_task_wake_after( TICKS_PER_SECOND );
55  directive_failed( status, "rtems_task_wake_after" );
56
57  puts( "Receiving message ..." );
58  status = rtems_message_queue_receive(
59    Queue_id[ 1 ],
60    (long (*)[4])receive_buffer,
61    RTEMS_DEFAULT_OPTIONS,
62    2 * TICKS_PER_SECOND
63  );
64  fatal_directive_status(status, RTEMS_TIMEOUT, "rtems_message_queue_receive");
65  puts( "rtems_message_queue_receive correctly returned RTEMS_TIMEOUT" );
66
67  puts( "Deleting self" );
68  status = rtems_task_delete( RTEMS_SELF );
69  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
70}
Note: See TracBrowser for help on using the repository browser.