diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-11-21 18:23:11 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-11-21 18:23:11 +0000 |
commit | 0871923f533e5f70650d2256971f7816145c3127 (patch) | |
tree | 4ef11dd78416dba31ae58d76ab20da1658138154 | |
parent | c86dc7acc161cbc06853120be5141b99ffa4ec3d (diff) | |
download | ATCD-0871923f533e5f70650d2256971f7816145c3127.tar.gz |
*** empty log message ***
-rw-r--r-- | ChangeLog-97b | 5 | ||||
-rw-r--r-- | ace/Acceptor.cpp | 15 | ||||
-rw-r--r-- | ace/Strategies_T.cpp | 35 |
3 files changed, 33 insertions, 22 deletions
diff --git a/ChangeLog-97b b/ChangeLog-97b index 60ee014b21e..ae84cf4dbf6 100644 --- a/ChangeLog-97b +++ b/ChangeLog-97b @@ -1,4 +1,7 @@ -Fri Nov 21 10:23:14 1997 Douglas C. Schmidt <schmidt@flamenco.cs.wustl.edu> +Fri Nov 21 12:18:28 1997 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> + + * ace/Acceptor.cpp,Strategy_T.cpp: Removed the use of gotos. See + Dijkstra '67 for motivation... * tests/Process_Strategy_Test.cpp (open): Make sure that we set the Reactor of the Svc_Handler to 0 if we're running the diff --git a/ace/Acceptor.cpp b/ace/Acceptor.cpp index b5864420a65..888bf26fd92 100644 --- a/ace/Acceptor.cpp +++ b/ace/Acceptor.cpp @@ -259,23 +259,26 @@ ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::activate_svc_handler { ACE_TRACE ("ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::activate_svc_handler"); + int result = 0; + // See if we should enable non-blocking I/O on the <svc_handler>'s // peer. if (ACE_BIT_ENABLED (this->flags_, ACE_NONBLOCK) != 0) { if (svc_handler->peer ().enable (ACE_NONBLOCK) == -1) - goto failure; + result = -1; } // Otherwise, make sure it's disabled by default. else if (svc_handler->peer ().disable (ACE_NONBLOCK) == -1) - goto failure; + result = -1; if (svc_handler->open ((void *) this) != -1) - return 0; + result = -1; -failure: - svc_handler->close (0); - return -1; + if (result == -1) + svc_handler->close (0); + + return result; } // Template Method that makes a SVC_HANDLER (using the appropriate diff --git a/ace/Strategies_T.cpp b/ace/Strategies_T.cpp index 620825b5a61..4bdbab59b63 100644 --- a/ace/Strategies_T.cpp +++ b/ace/Strategies_T.cpp @@ -239,23 +239,26 @@ ACE_Concurrency_Strategy<SVC_HANDLER>::activate_svc_handler (SVC_HANDLER *svc_ha { ACE_TRACE ("ACE_Concurrency_Strategy<SVC_HANDLER>::activate_svc_handler"); + int result = 0; + // See if we should enable non-blocking I/O on the <svc_handler>'s // peer. if (ACE_BIT_ENABLED (this->flags_, ACE_NONBLOCK) != 0) { if (svc_handler->peer ().enable (ACE_NONBLOCK) == -1) - goto failure; + result = -1; } // Otherwise, make sure it's disabled by default. else if (svc_handler->peer ().disable (ACE_NONBLOCK) == -1) - goto failure; + result = -1; - if (svc_handler->open ((void *) this) != -1) - return 0; + if (result == 0 && svc_handler->open ((void *) this) == -1) + result = -1; -failure: - svc_handler->close (0); - return -1; + if (result == -1) + svc_handler->close (0); + + return result; } template <class SVC_HANDLER> @@ -328,16 +331,18 @@ ACE_Reactive_Strategy<SVC_HANDLER>::activate_svc_handler (SVC_HANDLER *svc_handl void *arg) { ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::activate_svc_handler"); + + int result = 0; if (this->reactor_ == 0) - goto failure; + result = -1; // Register with the Reactor with the appropriate <mask>. - if (this->reactor_->register_handler (svc_handler, this->mask_) == -1) - goto failure; + else if (this->reactor_->register_handler (svc_handler, this->mask_) == -1) + result = -1; // If the implementation of the reactor uses event associations - if (this->reactor_->uses_event_associations ()) + else if (this->reactor_->uses_event_associations ()) { // If we don't have non-block on, it won't work with // WFMO_Reactor @@ -347,15 +352,15 @@ ACE_Reactive_Strategy<SVC_HANDLER>::activate_svc_handler (SVC_HANDLER *svc_handl if (svc_handler->open ((void *) this) != -1) return 0; else - goto failure; + result = -1; } else // Call up to our parent to do the SVC_HANDLER initialization. return this->inherited::activate_svc_handler (svc_handler, arg); -failure: - svc_handler->close (0); - return -1; + if (result == -1) + svc_handler->close (0); + return result; } ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Strategy) |