summaryrefslogtreecommitdiffstats
path: root/testsuites/libtests/rtems++/Task2.cc
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1997-07-31 22:13:29 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1997-07-31 22:13:29 +0000
commit0074691a67f857c9b3f880fb581e0af1d5673337 (patch)
treef80fd23129ad62236ee4f64eeaf537f53bbaa0b8 /testsuites/libtests/rtems++/Task2.cc
parentMerged very large and much appreciated patch from Chris Johns (diff)
downloadrtems-0074691a67f857c9b3f880fb581e0af1d5673337.tar.bz2
Merged very large and much appreciated patch from Chris Johns
<cjohns@plessey.com.au>. This patch includes the ods68302 bsp, the RTEMS++ class library, and the rtems++ test.
Diffstat (limited to 'testsuites/libtests/rtems++/Task2.cc')
-rw-r--r--testsuites/libtests/rtems++/Task2.cc81
1 files changed, 81 insertions, 0 deletions
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);
+}
+
+