From 0074691a67f857c9b3f880fb581e0af1d5673337 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 31 Jul 1997 22:13:29 +0000 Subject: Merged very large and much appreciated patch from Chris Johns . This patch includes the ods68302 bsp, the RTEMS++ class library, and the rtems++ test. --- testsuites/libtests/rtems++/Task2.cc | 81 ++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 testsuites/libtests/rtems++/Task2.cc (limited to 'testsuites/libtests/rtems++/Task2.cc') diff --git a/testsuites/libtests/rtems++/Task2.cc b/testsuites/libtests/rtems++/Task2.cc new file mode 100644 index 0000000000..ab8c3cb78e --- /dev/null +++ b/testsuites/libtests/rtems++/Task2.cc @@ -0,0 +1,81 @@ +/* Task_2 + * + * This routine serves as a test task. Its only purpose is to generate the + * error where a semaphore is deleted while a task is waiting for it. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may in + * the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include "System.h" + +Task2::Task2(const char* name, + const rtems_task_priority initial_priority, + const rtems_unsigned32 stack_size) + : rtemsTask(name, initial_priority, stack_size, RTEMS_NO_PREEMPT) +{ +} + +void Task2::body(rtems_task_argument ) +{ + screen4(); + + printf("%s - destory itself\n", name_string()); + destroy(); +} + +void Task2::screen4() +{ + rtemsEvent event; + + // block waiting for any event + rtems_event_set out; + + printf("%s - event no wait - ", name_string()); + event.receive(RTEMS_SIGNAL_0, out, 0, rtemsEvent::no_wait); + printf("%s\n", event.last_status_string()); + + printf("%s - event 5 secs timeout - ", name_string()); fflush(stdout); + event.receive(RTEMS_SIGNAL_0, out, 5000000); + printf("%s\n", event.last_status_string()); + + // send using task id + printf("%s - event wait forever for signal 0 from TA1 ....\n", name_string()); + event.receive(RTEMS_SIGNAL_0, out); + printf("%s - %s, signals out are 0x%08X\n", name_string(), event.last_status_string(), out); + + // send using task object reference + printf("%s - event wait forever for signal 0 from TA1 ....\n", name_string()); + event.receive(RTEMS_SIGNAL_0, out); + printf("%s - %s, signals out are 0x%08X\n", name_string(), event.last_status_string(), out); + + printf("%s - event wait forever for signal 31 from TA1 ....\n", name_string()); + event.receive(RTEMS_SIGNAL_31, out); + printf("%s - %s, signals out are 0x%08X\n", name_string(), event.last_status_string(), out); + + printf("%s - event wait forever for signal 0 and 31 from TA1 ....\n", name_string()); + event.receive(RTEMS_SIGNAL_0 | RTEMS_SIGNAL_31, out, 0, rtemsEvent::wait, rtemsEvent::all); + printf("%s - %s, signals out are 0x%08X\n", name_string(), event.last_status_string(), out); + + printf("%s - send event signal 1 - ", name_string()); + event.send(RTEMS_SIGNAL_1); + printf("%s\n", event.last_status_string()); + + printf("%s - event wait forever for signal 1 from TA2 - ", name_string()); + event.receive(RTEMS_SIGNAL_1, out, 0, rtemsEvent::wait, rtemsEvent::all); + printf("%s, signals out are 0x%08X\n", event.last_status_string(), out); +} + + -- cgit v1.2.3