diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-05-06 21:31:57 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-05-06 21:31:57 +0000 |
commit | b6ea1dd73ea4534322e8644cff29dbb87a05cdc9 (patch) | |
tree | 192f23d12c91995889fbac5f7539f2528195a58e | |
parent | 4966058e3e9a42792845d2c9c8154972a22cf369 (diff) | |
download | ATCD-b6ea1dd73ea4534322e8644cff29dbb87a05cdc9.tar.gz |
ChangeLogTag: Mon May 06 16:31:14 2002 Irfan Pyarali <irfan@cs.wustl.edu>
-rw-r--r-- | ChangeLog | 26 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-02a | 26 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03a | 26 | ||||
-rw-r--r-- | examples/Reactor/WFMO_Reactor/APC.cpp | 6 | ||||
-rw-r--r-- | examples/Reactor/WFMO_Reactor/Abandoned.cpp | 6 | ||||
-rw-r--r-- | examples/Reactor/WFMO_Reactor/Handle_Close.cpp | 14 | ||||
-rw-r--r-- | examples/Reactor/WFMO_Reactor/Multithreading.cpp | 6 | ||||
-rw-r--r-- | examples/Reactor/WFMO_Reactor/Network_Events.cpp | 5 | ||||
-rw-r--r-- | examples/Reactor/WFMO_Reactor/Talker.cpp | 18 | ||||
-rwxr-xr-x | examples/Reactor/WFMO_Reactor/run_test.pl | 12 |
10 files changed, 124 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog index 454d8dea455..8bc6ca7e1bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +Mon May 06 16:31:14 2002 Irfan Pyarali <irfan@cs.wustl.edu> + + * examples/Reactor/WFMO_Reactor/Abandoned.cpp (handle_timeout): + * examples/Reactor/WFMO_Reactor/APC.cpp (handle_signal): + + Make sure to remove handlers from the reactor if they are not + going to be around when the reactor closes down. + + * examples/Reactor/WFMO_Reactor/Handle_Close.cpp: Reactor creation + was buggy and the wrong reactor's event loop was being run. + + * examples/Reactor/WFMO_Reactor/Talker.cpp: STDIN handler was not + getting cleaned up properly. Also, Proactor was not getting + removed properly from the Reactor. + + * examples/Reactor/WFMO_Reactor/Network_Events.cpp: Network + listener was not getting cleaned up properly. + + * examples/Reactor/WFMO_Reactor/Multithreading.cpp (Task_Handler): + Fixed an "out of bounds" error where a "for" loop that was going + from 1 to n rather than from 0 to n-1. Also, added a debug + statement. + + * examples/Reactor/WFMO_Reactor/run_test.pl: Redirected some of + the output from STDERR to STDOUT. + Mon May 06 15:45:35 2002 Nanbor Wang <nanbor@cs.wustl.edu> * ACEXML/parser/debug_validator/Debug_Validator.dsp: Fixed diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index 454d8dea455..8bc6ca7e1bd 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -1,3 +1,29 @@ +Mon May 06 16:31:14 2002 Irfan Pyarali <irfan@cs.wustl.edu> + + * examples/Reactor/WFMO_Reactor/Abandoned.cpp (handle_timeout): + * examples/Reactor/WFMO_Reactor/APC.cpp (handle_signal): + + Make sure to remove handlers from the reactor if they are not + going to be around when the reactor closes down. + + * examples/Reactor/WFMO_Reactor/Handle_Close.cpp: Reactor creation + was buggy and the wrong reactor's event loop was being run. + + * examples/Reactor/WFMO_Reactor/Talker.cpp: STDIN handler was not + getting cleaned up properly. Also, Proactor was not getting + removed properly from the Reactor. + + * examples/Reactor/WFMO_Reactor/Network_Events.cpp: Network + listener was not getting cleaned up properly. + + * examples/Reactor/WFMO_Reactor/Multithreading.cpp (Task_Handler): + Fixed an "out of bounds" error where a "for" loop that was going + from 1 to n rather than from 0 to n-1. Also, added a debug + statement. + + * examples/Reactor/WFMO_Reactor/run_test.pl: Redirected some of + the output from STDERR to STDOUT. + Mon May 06 15:45:35 2002 Nanbor Wang <nanbor@cs.wustl.edu> * ACEXML/parser/debug_validator/Debug_Validator.dsp: Fixed diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index 454d8dea455..8bc6ca7e1bd 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,29 @@ +Mon May 06 16:31:14 2002 Irfan Pyarali <irfan@cs.wustl.edu> + + * examples/Reactor/WFMO_Reactor/Abandoned.cpp (handle_timeout): + * examples/Reactor/WFMO_Reactor/APC.cpp (handle_signal): + + Make sure to remove handlers from the reactor if they are not + going to be around when the reactor closes down. + + * examples/Reactor/WFMO_Reactor/Handle_Close.cpp: Reactor creation + was buggy and the wrong reactor's event loop was being run. + + * examples/Reactor/WFMO_Reactor/Talker.cpp: STDIN handler was not + getting cleaned up properly. Also, Proactor was not getting + removed properly from the Reactor. + + * examples/Reactor/WFMO_Reactor/Network_Events.cpp: Network + listener was not getting cleaned up properly. + + * examples/Reactor/WFMO_Reactor/Multithreading.cpp (Task_Handler): + Fixed an "out of bounds" error where a "for" loop that was going + from 1 to n rather than from 0 to n-1. Also, added a debug + statement. + + * examples/Reactor/WFMO_Reactor/run_test.pl: Redirected some of + the output from STDERR to STDOUT. + Mon May 06 15:45:35 2002 Nanbor Wang <nanbor@cs.wustl.edu> * ACEXML/parser/debug_validator/Debug_Validator.dsp: Fixed diff --git a/examples/Reactor/WFMO_Reactor/APC.cpp b/examples/Reactor/WFMO_Reactor/APC.cpp index df49280cf2e..a09b2e2947b 100644 --- a/examples/Reactor/WFMO_Reactor/APC.cpp +++ b/examples/Reactor/WFMO_Reactor/APC.cpp @@ -66,7 +66,11 @@ Event_Handler::handle_signal (int, --this->iterations_; if (this->iterations_ == 0) - ACE_Reactor::end_event_loop (); + { + ACE_Reactor::instance ()->remove_handler (this->handle_.handle (), + ACE_Event_Handler::DONT_CALL); + ACE_Reactor::end_event_loop (); + } return 0; } diff --git a/examples/Reactor/WFMO_Reactor/Abandoned.cpp b/examples/Reactor/WFMO_Reactor/Abandoned.cpp index 74b64f0e3b3..ccc64db9057 100644 --- a/examples/Reactor/WFMO_Reactor/Abandoned.cpp +++ b/examples/Reactor/WFMO_Reactor/Abandoned.cpp @@ -84,7 +84,11 @@ Event_Handler::handle_timeout (const ACE_Time_Value &, this->iterations_)); if (this->iterations_ == 0) - ACE_Reactor::end_event_loop (); + { + ACE_Reactor::instance ()->remove_handler (this->handle_.handle (), + ACE_Event_Handler::DONT_CALL); + ACE_Reactor::end_event_loop (); + } else { ACE_NEW_RETURN (this->mutex_, diff --git a/examples/Reactor/WFMO_Reactor/Handle_Close.cpp b/examples/Reactor/WFMO_Reactor/Handle_Close.cpp index b857c8f87ee..ab25a1dd445 100644 --- a/examples/Reactor/WFMO_Reactor/Handle_Close.cpp +++ b/examples/Reactor/WFMO_Reactor/Handle_Close.cpp @@ -211,7 +211,6 @@ ACE_Reactor * create_reactor (void) { ACE_Reactor_Impl *impl = 0; - int delete_implementation = 0; if (opt_wfmo_reactor) { @@ -219,7 +218,6 @@ create_reactor (void) ACE_NEW_RETURN (impl, ACE_WFMO_Reactor, 0); - delete_implementation = 1; #endif /* ACE_WIN32 */ } else if (opt_select_reactor) @@ -227,19 +225,19 @@ create_reactor (void) ACE_NEW_RETURN (impl, ACE_Select_Reactor, 0); - delete_implementation = 1; } else { - impl = - ACE_Reactor::instance ()->implementation (); - delete_implementation = 0; + ACE_Reactor *singleton_reactor = + ACE_Reactor::instance (); + ACE_Reactor::instance (0); + return singleton_reactor; } ACE_Reactor *reactor = 0; ACE_NEW_RETURN (reactor, ACE_Reactor (impl, - delete_implementation), + 1), 0); return reactor; @@ -315,7 +313,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) // Run for three seconds ACE_Time_Value time (3); - reactor->run_event_loop (time); + reactor->run_reactor_event_loop (time); ACE_DEBUG ((LM_DEBUG, "\nClosing down the application\n\n")); diff --git a/examples/Reactor/WFMO_Reactor/Multithreading.cpp b/examples/Reactor/WFMO_Reactor/Multithreading.cpp index f8bd2dea539..b8d273fb397 100644 --- a/examples/Reactor/WFMO_Reactor/Multithreading.cpp +++ b/examples/Reactor/WFMO_Reactor/Multithreading.cpp @@ -126,7 +126,7 @@ Task_Handler::Task_Handler (size_t number_of_handles, { ACE_NEW (this->events_, ACE_Auto_Event [number_of_handles]); - for (size_t i = 1; i <= number_of_handles; i++) + for (size_t i = 0; i < number_of_handles; ++i) if (ACE_Reactor::instance ()->register_handler (this, this->events_[i].handle ()) == -1) ACE_ERROR ((LM_ERROR, @@ -154,6 +154,10 @@ Task_Handler::handle_signal (int, siginfo_t *siginfo, ucontext_t *) // When signaled, print message, remove self, and add self // This will force Reactor to update its internal handle tables + ACE_DEBUG ((LM_DEBUG, + "(%t) calls handle_signal for handle %d\n", + siginfo->si_handle_)); + if (ACE_Reactor::instance ()->remove_handler (siginfo->si_handle_, ACE_Event_Handler::DONT_CALL) == -1) return -1; diff --git a/examples/Reactor/WFMO_Reactor/Network_Events.cpp b/examples/Reactor/WFMO_Reactor/Network_Events.cpp index a33bdf75bc4..f5b636f97a6 100644 --- a/examples/Reactor/WFMO_Reactor/Network_Events.cpp +++ b/examples/Reactor/WFMO_Reactor/Network_Events.cpp @@ -190,13 +190,16 @@ Network_Listener::handle_close (ACE_HANDLE handle, this->acceptor_.close (); + delete this; + return 0; } int ACE_TMAIN (int, ACE_TCHAR *[]) { - Network_Listener listener; + Network_Listener *listener = + new Network_Listener; ACE_Reactor::run_event_loop (); diff --git a/examples/Reactor/WFMO_Reactor/Talker.cpp b/examples/Reactor/WFMO_Reactor/Talker.cpp index dd073cacd21..d2ffbfe9a93 100644 --- a/examples/Reactor/WFMO_Reactor/Talker.cpp +++ b/examples/Reactor/WFMO_Reactor/Talker.cpp @@ -232,6 +232,9 @@ public: int svc (void); // Thread runs here as an active object. + int handle_close (ACE_HANDLE, + ACE_Reactor_Mask); + private: static void handler (int signum); // Handle a ^C. (Do nothing, this just illustrates how we can catch @@ -520,6 +523,14 @@ STDIN_Handler::handle_signal (int, siginfo_t *si, ucontext_t *) } int +STDIN_Handler::handle_close (ACE_HANDLE, + ACE_Reactor_Mask) +{ + delete this; + return 0; +} + +int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { // Let the proactor know that it will be used with Reactor @@ -540,10 +551,11 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) "peer_handler", errno), 0); // Open active object for reading from stdin. - STDIN_Handler stdin_handler (peer_handler); + STDIN_Handler *stdin_handler = + new STDIN_Handler (peer_handler); // Spawn thread. - if (stdin_handler.open () == -1) + if (stdin_handler->open () == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p open failed, errno = %d.\n", "stdin_handler", errno), 0); @@ -560,7 +572,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) // Remove proactor with Reactor. if (ACE_Reactor::instance ()->remove_handler - (ACE_Proactor::instance (), ACE_Event_Handler::DONT_CALL) != 0) + (ACE_Proactor::instance ()->implementation (), ACE_Event_Handler::DONT_CALL) != 0) ACE_ERROR_RETURN ((LM_ERROR, "%p failed to register Proactor.\n", argv[0]), -1); diff --git a/examples/Reactor/WFMO_Reactor/run_test.pl b/examples/Reactor/WFMO_Reactor/run_test.pl index 4eb7284ad28..c03dd3bc20c 100755 --- a/examples/Reactor/WFMO_Reactor/run_test.pl +++ b/examples/Reactor/WFMO_Reactor/run_test.pl @@ -41,9 +41,9 @@ $test_timeout = 60; for $test (@tests) { - print STDERR "\n________________________________________\n"; - print STDERR "\nStarting test \"$test\""; - print STDERR "\n________________________________________\n\n"; + print STDOUT "\n________________________________________\n"; + print STDOUT "\nStarting test \"$test\""; + print STDOUT "\n________________________________________\n\n"; $test_process = new PerlACE::Process ($test); $test_process->Spawn (); @@ -56,7 +56,7 @@ for $test (@tests) print STDERR "\n________________________________________\n"; } - print STDERR "\n________________________________________\n"; - print STDERR "\n\"$test\" completed"; - print STDERR "\n________________________________________\n"; + print STDOUT "\n________________________________________\n"; + print STDOUT "\n\"$test\" completed"; + print STDOUT "\n________________________________________\n"; } |