source: rtems/testsuites/mptests/mp13/task1.c @ 16ce0e70

4.104.114.84.95
Last change on this file since 16ce0e70 was d8e681e, checked in by Ralf Corsepius <ralf.corsepius@…>, on 03/30/04 at 11:18:29

2004-03-30 Ralf Corsepius <ralf_corsepius@…>

  • mp02/task1.c, mp03/system.h, mp03/task1.c, mp04/task1.c, mp05/system.h, mp06/task1.c, mp07/task1.c, mp08/task1.c, mp09/recvmsg.c, mp09/sendmsg.c, mp09/task1.c, mp10/task1.c, mp11/init.c, mp12/init.c, mp13/task1.c, mp14/evtask1.c, mp14/evtmtask.c, mp14/init.c, mp14/msgtask1.c, mp14/pttask1.c, mp14/smtask1.c, mp14/system.h: Convert to using c99 fixed size types.
  • 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-1999.
13 *  On-Line Applications Research Corporation (OAR).
14 *
15 *  The license and distribution terms for this file may be
16 *  found in the file LICENSE in this distribution or at
17 *  http://www.rtems.com/license/LICENSE.
18 *
19 *  $Id$
20 */
21
22#include "system.h"
23
24rtems_task Test_task1(
25  rtems_task_argument argument
26)
27{
28  char              receive_buffer[16];
29  uint32_t    size;
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      &size,
48      RTEMS_DEFAULT_OPTIONS,
49      RTEMS_NO_TIMEOUT
50    );
51    puts( "How did I get back from here????" );
52    directive_failed( status, "rtems_message_queue_receive" );
53  }
54
55  status = rtems_task_wake_after( TICKS_PER_SECOND );
56  directive_failed( status, "rtems_task_wake_after" );
57
58  puts( "Receiving message ..." );
59  status = rtems_message_queue_receive(
60    Queue_id[ 1 ],
61    (long (*)[4])receive_buffer,
62    &size,
63    RTEMS_DEFAULT_OPTIONS,
64    2 * TICKS_PER_SECOND
65  );
66  fatal_directive_status(status, RTEMS_TIMEOUT, "rtems_message_queue_receive");
67  puts( "rtems_message_queue_receive correctly returned RTEMS_TIMEOUT" );
68
69  puts( "Deleting self" );
70  status = rtems_task_delete( RTEMS_SELF );
71  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
72}
Note: See TracBrowser for help on using the repository browser.