diff options
author | Phil Mesnier <mesnier_p@ociweb.com> | 2006-11-03 00:38:39 +0000 |
---|---|---|
committer | Phil Mesnier <mesnier_p@ociweb.com> | 2006-11-03 00:38:39 +0000 |
commit | de5cc157323fecd342fbc3a2a07342df46cbe21a (patch) | |
tree | 402c1ffc8af91ac2d971cd498cef6d3b167bcbe1 | |
parent | 6a926a343333467c20af867b300b9891e84695e2 (diff) | |
download | ATCD-de5cc157323fecd342fbc3a2a07342df46cbe21a.tar.gz |
Fri Nov 3 00:32:27 UTC 2006 Phil Mesnier <mesnier_p@ociweb.com>
-rw-r--r-- | ACE/ChangeLog | 34 | ||||
-rw-r--r-- | ACE/ace/Select_Reactor_Base.cpp | 19 | ||||
-rw-r--r-- | ACE/ace/Select_Reactor_Base.inl | 16 |
3 files changed, 40 insertions, 29 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog index e3bd0075b73..66ddcd2b920 100644 --- a/ACE/ChangeLog +++ b/ACE/ChangeLog @@ -1,17 +1,27 @@ +Fri Nov 3 00:32:27 UTC 2006 Phil Mesnier <mesnier_p@ociweb.com> + + * ace/Select_Reactor_Base.inl: + * ace/Select_Reactor_Base.cpp: + Additional optimization for finding and unbinding event + handlers. The solution moves the test for handles in range into + the top-level find and unbind methods to allow the fix for bug + 2653 to continue to work in unbind while avoiding a double check + for handles in range during a find. + Thu Nov 2 20:33:55 UTC 2006 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> - * tests/SOCK_Test_IPv6.cpp (spawn): - * tests/Pipe_Test.cpp (run_main): - * tests/SPIPE_Test.cpp (client): - * tests/TkReactor_Test.cpp (run_main): - * tests/MT_SOCK_Test.cpp (spawn): - * tests/Process_Strategy_Test.cpp (run_main): - * tests/Unload_libACE.cpp (main): - * tests/SOCK_Test.cpp (spawn): - * tests/Priority_Reactor_Test.cpp (run_main): - * tests/SOCK_Dgram_Test.cpp (spawn): - * tests/SOCK_SEQPACK_SCTP_Test.cpp (spawn_test): - * examples/Map_Manager/test_hash_map_manager.cpp (ACE_TMAIN): + * tests/SOCK_Test_IPv6.cpp (spawn): + * tests/Pipe_Test.cpp (run_main): + * tests/SPIPE_Test.cpp (client): + * tests/TkReactor_Test.cpp (run_main): + * tests/MT_SOCK_Test.cpp (spawn): + * tests/Process_Strategy_Test.cpp (run_main): + * tests/Unload_libACE.cpp (main): + * tests/SOCK_Test.cpp (spawn): + * tests/Priority_Reactor_Test.cpp (run_main): + * tests/SOCK_Dgram_Test.cpp (spawn): + * tests/SOCK_SEQPACK_SCTP_Test.cpp (spawn_test): + * examples/Map_Manager/test_hash_map_manager.cpp (ACE_TMAIN): * apps/mkcsregdb/mkcsregdb.cpp (fail): Replaced exit() with ACE_OS::exit(). diff --git a/ACE/ace/Select_Reactor_Base.cpp b/ACE/ace/Select_Reactor_Base.cpp index 309f0777819..94fa673b84e 100644 --- a/ACE/ace/Select_Reactor_Base.cpp +++ b/ACE/ace/Select_Reactor_Base.cpp @@ -175,18 +175,15 @@ ACE_Select_Reactor_Handler_Repository::find_eh (ACE_HANDLE handle) map_type::iterator pos (this->event_handlers_.end ()); - // Only bother to search for the <handle> if it's in range. - if (this->handle_in_range (handle)) - { + // this code assumes the handle is in range. #if defined (ACE_WIN32) - this->event_handlers_.find (handle, pos); + this->event_handlers_.find (handle, pos); #else - map_type::iterator const tmp = &this->event_handlers_[handle]; + map_type::iterator const tmp = &this->event_handlers_[handle]; - if (*tmp != 0) - pos = tmp; + if (*tmp != 0) + pos = tmp; #endif /* ACE_WIN32 */ - } return pos; } @@ -302,8 +299,8 @@ ACE_Select_Reactor_Handler_Repository::unbind ( // iterator pointing to it will no longer be valid once the handler // is unbound. ACE_Event_Handler * const event_handler = - (pos == this->event_handlers_.end () - ? 0 + (pos == this->event_handlers_.end () + ? 0 : ACE_SELECT_REACTOR_EVENT_HANDLER (pos)); // Clear out the <mask> bits in the Select_Reactor's wait_set. @@ -496,7 +493,7 @@ ACE_Select_Reactor_Handler_Repository::dump (void) const # define ACE_HANDLE_FORMAT_SPECIFIER ACE_LIB_TEXT("%d") # define ACE_MAX_HANDLEP1_FORMAT_SPECIFIER ACE_LIB_TEXT("%d") # endif /* ACE_WIN32 */ - + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("max_handlep1_ = ") diff --git a/ACE/ace/Select_Reactor_Base.inl b/ACE/ace/Select_Reactor_Base.inl index 16bdd67b2b8..88890778b70 100644 --- a/ACE/ace/Select_Reactor_Base.inl +++ b/ACE/ace/Select_Reactor_Base.inl @@ -33,7 +33,8 @@ ACE_Select_Reactor_Handler_Repository::unbind (ACE_HANDLE handle, // Do not refactor this code to optimize the call to the unbind impl. // To resolve bug 2653, unbind must be called even when find_eh returns // event_handlers_.end(). - return (handle == ACE_INVALID_HANDLE) ? -1 + + return !this->handle_in_range (handle) ? -1 : this->unbind (handle, this->find_eh (handle), mask); @@ -46,15 +47,18 @@ ACE_Select_Reactor_Handler_Repository::find (ACE_HANDLE handle) ACE_Event_Handler * eh = 0; - map_type::iterator const pos = this->find_eh (handle); - - if (pos != this->event_handlers_.end ()) + if (this->handle_in_range (handle)) { + map_type::iterator const pos = this->find_eh (handle); + + if (pos != this->event_handlers_.end ()) + { #ifdef ACE_WIN32 - eh = (*pos).item (); + eh = (*pos).item (); #else - eh = *pos; + eh = *pos; #endif /* ACE_WIN32 */ + } } // Don't bother setting errno. It isn't used in the select()-based // reactors and incurs a TSS access. |