source: rtems/testsuites/libtests/rtems++/Task2.cc @ 1fcff14

4.104.115
Last change on this file since 1fcff14 was 1fcff14, checked in by Ralf Corsepius <ralf.corsepius@…>, on Nov 14, 2009 at 9:09:34 PM

2009-11-14 Ralf Corsépius <ralf.corsepius@…>

  • rtems++/Task1.cc, rtems++/Task2.cc: Spray PRI* macros to eliminate several dozens of warnings.
  • Property mode set to 100644
File size: 2.6 KB
Line 
1/*  Task_2
2 *
3 *  This routine serves as a test task.  Its only purpose is to generate the
4 *  error where a semaphore is deleted while a task is waiting for it.
5 *
6 *  Input parameters:
7 *    argument - task argument
8 *
9 *  Output parameters:  NONE
10 *
11 *  COPYRIGHT (c) 1989-1999.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.com/license/LICENSE.
17 *
18 *  $Id$
19 */
20
21#include "System.h"
22
23Task2::Task2(const char* name,
24             const rtems_task_priority initial_priority,
25             const uint32_t   stack_size)
26  : rtemsTask(name, initial_priority, stack_size, RTEMS_NO_PREEMPT)
27{
28}
29 
30void Task2::body(rtems_task_argument )
31{
32  screen4();
33
34  printf("%s - destroy itself\n", name_string());
35  destroy();
36}
37
38void Task2::screen4()
39{
40  rtemsEvent event;
41
42  // block waiting for any event
43  rtems_event_set out;
44 
45  printf("%s - event no wait - ", name_string());
46  event.receive(RTEMS_SIGNAL_0, out, 0, rtemsEvent::no_wait);
47  printf("%s\n", event.last_status_string());
48 
49  printf("%s - event 5 secs timeout - ", name_string()); fflush(stdout);
50  event.receive(RTEMS_SIGNAL_0, out, 5000000);
51  printf("%s\n", event.last_status_string());
52
53  // send using task id
54  printf("%s - event wait forever for signal 0 from TA1 ....\n", name_string());
55  event.receive(RTEMS_SIGNAL_0, out);
56  printf("%s - %s, signals out are 0x%08" PRIX32 "\n", name_string(), event.last_status_string(), out);
57
58  // send using task object reference
59  printf("%s - event wait forever for signal 0 from TA1 ....\n", name_string());
60  event.receive(RTEMS_SIGNAL_0, out);
61  printf("%s - %s, signals out are 0x%08" PRIX32 "\n", name_string(), event.last_status_string(), out);
62 
63  printf("%s - event wait forever for signal 31 from TA1 ....\n", name_string());
64  event.receive(RTEMS_SIGNAL_31, out);
65  printf("%s - %s, signals out are 0x%08" PRIX32 "\n", name_string(), event.last_status_string(), out);
66 
67  printf("%s - event wait forever for signal 0 and 31 from TA1 ....\n", name_string());
68  event.receive(RTEMS_SIGNAL_0 | RTEMS_SIGNAL_31, out, 0, rtemsEvent::wait, rtemsEvent::all);
69  printf("%s - %s, signals out are 0x%08" PRIX32 "\n", name_string(), event.last_status_string(), out);
70
71  printf("%s - send event signal 1 - ", name_string());
72  event.send(RTEMS_SIGNAL_1);
73  printf("%s\n", event.last_status_string());
74 
75  printf("%s - event wait forever for signal 1 from TA2 - ", name_string());
76  event.receive(RTEMS_SIGNAL_1, out, 0, rtemsEvent::wait, rtemsEvent::all);
77  printf("%s, signals out are 0x%08" PRIX32 "\n", event.last_status_string(), out); 
78}
79
80
Note: See TracBrowser for help on using the repository browser.