summaryrefslogtreecommitdiff
path: root/examples/Reactor/Misc/test_demuxing.cpp
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1997-02-17 06:33:38 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1997-02-17 06:33:38 +0000
commit23967b2e3639282712e1b550421bb00ef8b753fc (patch)
treed84a9eef69d8580ab2d2abed003f3bbbb64107c9 /examples/Reactor/Misc/test_demuxing.cpp
parent83379a56bcf820a1b7b9974ec89c59915f1816d8 (diff)
downloadATCD-23967b2e3639282712e1b550421bb00ef8b753fc.tar.gz
foo
Diffstat (limited to 'examples/Reactor/Misc/test_demuxing.cpp')
-rw-r--r--examples/Reactor/Misc/test_demuxing.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/examples/Reactor/Misc/test_demuxing.cpp b/examples/Reactor/Misc/test_demuxing.cpp
index 56c8e6cf400..576bd89bb4c 100644
--- a/examples/Reactor/Misc/test_demuxing.cpp
+++ b/examples/Reactor/Misc/test_demuxing.cpp
@@ -14,6 +14,9 @@
// Used to shut down the event loop.
static sig_atomic_t done = 0;
+// Default is to have a 2 second timeout.
+static int timeout = 2;
+
// This class illustrates how to handle signal-driven I/O using the
// ACE_Reactor framework. Note that signals may be caught and
// processed without requiring the use of global signal handler
@@ -152,9 +155,10 @@ STDIN_Handler::STDIN_Handler (void)
ACE_Service_Config::thr_mgr ()) == -1)
ACE_ERROR ((LM_ERROR, "%p\n", "register_stdin_handler"));
- // Register the STDIN_Handler to be dispatched once every two seconds.
+ // Register the STDIN_Handler to be dispatched once every <timeout>
+ // seconds.
else if (ACE_Service_Config::reactor ()->schedule_timer
- (this, 0, ACE_Time_Value (2), ACE_Time_Value (2)) == -1)
+ (this, 0, ACE_Time_Value (timeout), ACE_Time_Value (timeout)) == -1)
ACE_ERROR ((LM_ERROR, "%p\n%a", "schedule_timer", 1));
}
@@ -281,6 +285,13 @@ main (int argc, char *argv[])
{
ACE_Service_Config daemon (argv [0]);
+ // Optionally start the alarm.
+ if (argc > 1)
+ {
+ ACE_OS::alarm (4);
+ timeout = ACE_OS::atoi (argv[1]);
+ }
+
// Signal handler.
Sig_Handler sh;
@@ -290,10 +301,6 @@ main (int argc, char *argv[])
// Define a message handler.
Message_Handler mh;
- // Optionally start the alarm.
- if (argc > 1)
- ACE_OS::alarm (4);
-
// Loop handling signals and I/O events until SIGQUIT occurs.
while (daemon.reactor_event_loop_done () == 0)