source: rtems/testsuites/libtests/rtems++/Task2.cc @ 9919946a

4.104.114.84.95
Last change on this file since 9919946a was 9919946a, checked in by Ralf Corsepius <ralf.corsepius@…>, on 03/30/04 at 11:12:47

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

  • cpuuse/system.h, cpuuse/task1.c, cpuuse/tswitch.c, monitor/init.c, monitor/system.h, rtems++/System.h, rtems++/Task1.cc, rtems++/Task2.cc, rtems++/Task3.cc, rtmonuse/init.c, rtmonuse/system.h, rtmonuse/task1.c, stackchk/blow.c: Convert to using c99 fixed size types.
  • Property mode set to 100644
File size: 2.6 KB
RevLine 
[0074691a]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 *
[08311cc3]11 *  COPYRIGHT (c) 1989-1999.
[0074691a]12 *  On-Line Applications Research Corporation (OAR).
13 *
[98e4ebf5]14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
[2abdd87]16 *  http://www.rtems.com/license/LICENSE.
[0074691a]17 *
18 *  $Id$
19 */
20
21#include "System.h"
22
23Task2::Task2(const char* name,
24             const rtems_task_priority initial_priority,
[9919946a]25             const uint32_t   stack_size)
[0074691a]26  : rtemsTask(name, initial_priority, stack_size, RTEMS_NO_PREEMPT)
27{
28}
29 
30void Task2::body(rtems_task_argument )
31{
32  screen4();
33
[2d60095]34  printf("%s - destroy itself\n", name_string());
[0074691a]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%08X\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%08X\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%08X\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%08X\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%08X\n", event.last_status_string(), out); 
78}
79
80
Note: See TracBrowser for help on using the repository browser.