diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-03-23 10:45:47 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-03-23 10:45:47 +0000 |
commit | 7aba385c947910668bddf9a342e7b1a21540014b (patch) | |
tree | 7caa26deb966ef90ef53c8e5626dc00e32b7d055 | |
parent | 089dd34dffdeb194dc9cd50f1e46dfae668416e0 (diff) | |
download | ATCD-7aba385c947910668bddf9a342e7b1a21540014b.tar.gz |
ChangeLogTag: Thu Mar 23 04:31:50 2000 Irfan Pyarali <irfan@cs.wustl.edu>
-rw-r--r-- | ChangeLog | 19 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-02a | 19 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03a | 19 | ||||
-rw-r--r-- | ace/Reactor.i | 86 |
4 files changed, 118 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog index bcc017f6460..60c19e53cda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +Thu Mar 23 04:31:50 2000 Irfan Pyarali <irfan@cs.wustl.edu> + + * ace/Reactor.i (register_handler): There was a very subtle bug in + all versions of <register_handler>. The problem was that once + the <event_handler> has been successfully registered with the + Reactor, it is available for processing events. In the problem + case, input arrived from the client, the handler handled it, and + eventually closed down. All this happened in the other thread + running the Reactor, and all before this line got executed: + + event_handler->reactor (this); + + By the time this thread came around to set the <reactor>, the + <event_handler> had packed up and gone home. The fix is to set + the <reactor> before registering the <event_handler> with the + <reactor>. Thanks to Steve Huston for report this bug. + Wed Mar 22 12:01:22 2000 Steve Huston <shuston@riverace.com> * ace/NT_Service.{h i cpp}: Added support for operating on services @@ -25,7 +42,7 @@ Wed Mar 22 09:24:12 2000 Balachandran Natarajan <bala@cs.wustl.edu> instantiations from the end of the file to the top of the file. Thanks to Dr.Levine for helping me fix this and thanks to Manuel Benche <mbenche@jazz.cs.utsa.edu> for reporting this - problem. + problem. Wed Mar 22 09:16:48 2000 Jeff Parsons <parsons@cs.wustl.edu> diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index bcc017f6460..60c19e53cda 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -1,3 +1,20 @@ +Thu Mar 23 04:31:50 2000 Irfan Pyarali <irfan@cs.wustl.edu> + + * ace/Reactor.i (register_handler): There was a very subtle bug in + all versions of <register_handler>. The problem was that once + the <event_handler> has been successfully registered with the + Reactor, it is available for processing events. In the problem + case, input arrived from the client, the handler handled it, and + eventually closed down. All this happened in the other thread + running the Reactor, and all before this line got executed: + + event_handler->reactor (this); + + By the time this thread came around to set the <reactor>, the + <event_handler> had packed up and gone home. The fix is to set + the <reactor> before registering the <event_handler> with the + <reactor>. Thanks to Steve Huston for report this bug. + Wed Mar 22 12:01:22 2000 Steve Huston <shuston@riverace.com> * ace/NT_Service.{h i cpp}: Added support for operating on services @@ -25,7 +42,7 @@ Wed Mar 22 09:24:12 2000 Balachandran Natarajan <bala@cs.wustl.edu> instantiations from the end of the file to the top of the file. Thanks to Dr.Levine for helping me fix this and thanks to Manuel Benche <mbenche@jazz.cs.utsa.edu> for reporting this - problem. + problem. Wed Mar 22 09:16:48 2000 Jeff Parsons <parsons@cs.wustl.edu> diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index bcc017f6460..60c19e53cda 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,20 @@ +Thu Mar 23 04:31:50 2000 Irfan Pyarali <irfan@cs.wustl.edu> + + * ace/Reactor.i (register_handler): There was a very subtle bug in + all versions of <register_handler>. The problem was that once + the <event_handler> has been successfully registered with the + Reactor, it is available for processing events. In the problem + case, input arrived from the client, the handler handled it, and + eventually closed down. All this happened in the other thread + running the Reactor, and all before this line got executed: + + event_handler->reactor (this); + + By the time this thread came around to set the <reactor>, the + <event_handler> had packed up and gone home. The fix is to set + the <reactor> before registering the <event_handler> with the + <reactor>. Thanks to Steve Huston for report this bug. + Wed Mar 22 12:01:22 2000 Steve Huston <shuston@riverace.com> * ace/NT_Service.{h i cpp}: Added support for operating on services @@ -25,7 +42,7 @@ Wed Mar 22 09:24:12 2000 Balachandran Natarajan <bala@cs.wustl.edu> instantiations from the end of the file to the top of the file. Thanks to Dr.Levine for helping me fix this and thanks to Manuel Benche <mbenche@jazz.cs.utsa.edu> for reporting this - problem. + problem. Wed Mar 22 09:16:48 2000 Jeff Parsons <parsons@cs.wustl.edu> diff --git a/ace/Reactor.i b/ace/Reactor.i index 9c3264cc1b4..bc7d5ab59d9 100644 --- a/ace/Reactor.i +++ b/ace/Reactor.i @@ -167,11 +167,17 @@ ACE_INLINE int ACE_Reactor::register_handler (ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask) { + // Remember the old reactor. + ACE_Reactor *old_reactor = event_handler->reactor (); + + // Assign *this* <Reactor> to the <Event_Handler>. + event_handler->reactor (this); + int result = this->implementation ()->register_handler (event_handler, mask); - if (result != -1) - // Assign *this* <Reactor> to the <Event_Handler>. - event_handler->reactor (this); + if (result == -1) + // Reset the old reactor in case of failures. + event_handler->reactor (old_reactor); return result; } @@ -181,12 +187,18 @@ ACE_Reactor::register_handler (ACE_HANDLE io_handle, ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask) { + // Remember the old reactor. + ACE_Reactor *old_reactor = event_handler->reactor (); + + // Assign *this* <Reactor> to the <Event_Handler>. + event_handler->reactor (this); + int result = this->implementation ()->register_handler (io_handle, event_handler, mask); - if (result != -1) - // Assign *this* <Reactor> to the <Event_Handler>. - event_handler->reactor (this); + if (result == -1) + // Reset the old reactor in case of failures. + event_handler->reactor (old_reactor); return result; } @@ -197,11 +209,17 @@ ACE_INLINE int ACE_Reactor::register_handler (ACE_Event_Handler *event_handler, ACE_HANDLE event_handle) { + // Remember the old reactor. + ACE_Reactor *old_reactor = event_handler->reactor (); + + // Assign *this* <Reactor> to the <Event_Handler>. + event_handler->reactor (this); + int result = this->implementation ()->register_handler (event_handler, event_handle); - if (result != -1) - // Assign *this* <Reactor> to the <Event_Handler>. - event_handler->reactor (this); + if (result == -1) + // Reset the old reactor in case of failures. + event_handler->reactor (old_reactor); return result; } @@ -214,13 +232,19 @@ ACE_Reactor::register_handler (ACE_HANDLE event_handle, ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask) { + // Remember the old reactor. + ACE_Reactor *old_reactor = event_handler->reactor (); + + // Assign *this* <Reactor> to the <Event_Handler>. + event_handler->reactor (this); + int result = this->implementation ()->register_handler (event_handle, io_handle, event_handler, mask); - if (result != -1) - // Assign *this* <Reactor> to the <Event_Handler>. - event_handler->reactor (this); + if (result == -1) + // Reset the old reactor in case of failures. + event_handler->reactor (old_reactor); return result; } @@ -230,12 +254,18 @@ ACE_Reactor::register_handler (const ACE_Handle_Set &handles, ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask) { + // Remember the old reactor. + ACE_Reactor *old_reactor = event_handler->reactor (); + + // Assign *this* <Reactor> to the <Event_Handler>. + event_handler->reactor (this); + int result = this->implementation ()->register_handler (handles, event_handler, mask); - if (result != -1) - // Assign *this* <Reactor> to the <Event_Handler>. - event_handler->reactor (this); + if (result == -1) + // Reset the old reactor in case of failures. + event_handler->reactor (old_reactor); return result; } @@ -358,7 +388,7 @@ ACE_Reactor::resume_handlers (void) ACE_INLINE int ACE_Reactor::reset_timer_interval - (long timer_id, + (long timer_id, const ACE_Time_Value &interval) { ACE_TRACE ("ACE_Reactor::reset_timer_interval"); @@ -374,13 +404,19 @@ ACE_Reactor::schedule_timer (ACE_Event_Handler *event_handler, const ACE_Time_Value &delta, const ACE_Time_Value &interval) { + // Remember the old reactor. + ACE_Reactor *old_reactor = event_handler->reactor (); + + // Assign *this* <Reactor> to the <Event_Handler>. + event_handler->reactor (this); + int result = this->implementation ()->schedule_timer (event_handler, arg, delta, interval); - if (result != -1) - // Assign *this* <Reactor> to the <Event_Handler>. - event_handler->reactor (this); + if (result == -1) + // Reset the old reactor in case of failures. + event_handler->reactor (old_reactor); return result; } @@ -408,11 +444,17 @@ ACE_INLINE int ACE_Reactor::schedule_wakeup (ACE_Event_Handler *event_handler, ACE_Reactor_Mask masks_to_be_added) { + // Remember the old reactor. + ACE_Reactor *old_reactor = event_handler->reactor (); + + // Assign *this* <Reactor> to the <Event_Handler>. + event_handler->reactor (this); + int result = this->implementation ()->schedule_wakeup (event_handler, masks_to_be_added); - if (result != -1) - // Assign *this* <Reactor> to the <Event_Handler>. - event_handler->reactor (this); + if (result == -1) + // Reset the old reactor in case of failures. + event_handler->reactor (old_reactor); return result; } |