source: rtems/c/src/tests/libtests/rtems++/Task2.cc @ 2abdd87

4.104.114.84.95
Last change on this file since 2abdd87 was 2abdd87, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:53:27

2003-09-04 Joel Sherrill <joel@…>

  • cpuuse/init.c, cpuuse/system.h, cpuuse/task1.c, cpuuse/task2.c, cpuuse/task3.c, cpuuse/tswitch.c, malloctest/init.c, malloctest/system.h, malloctest/task1.c, monitor/init.c, monitor/system.h, putenvtest/init.c, rtems++/Init.cc, rtems++/System.h, rtems++/Task1.cc, rtems++/Task2.cc, rtems++/Task3.cc, rtems++/rtems++.doc, rtmonuse/getall.c, rtmonuse/init.c, rtmonuse/system.h, rtmonuse/task1.c, stackchk/blow.c, stackchk/init.c, stackchk/system.h, stackchk/task1.c: URL for license changed.
  • 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 rtems_unsigned32 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%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.