diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-05-17 17:57:50 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-05-17 17:57:50 +0000 |
commit | b2238b2f8a302f16e0868ca2b57060314623ae14 (patch) | |
tree | 91f3f4c57a096e4ceefb380e4f4a393e409b7775 /ace | |
parent | 4332bbcfab4daf1c8343254d69e24208a94d591a (diff) | |
download | ATCD-b2238b2f8a302f16e0868ca2b57060314623ae14.tar.gz |
*** empty log message ***
Diffstat (limited to 'ace')
-rw-r--r-- | ace/Acceptor.cpp | 22 | ||||
-rw-r--r-- | ace/Acceptor.h | 24 | ||||
-rw-r--r-- | ace/Connector.cpp | 47 | ||||
-rw-r--r-- | ace/Connector.h | 40 | ||||
-rw-r--r-- | ace/Strategies_T.cpp | 18 | ||||
-rw-r--r-- | ace/Timer_Heap_T.cpp | 6 | ||||
-rw-r--r-- | ace/Timer_List_T.cpp | 8 | ||||
-rw-r--r-- | ace/Timer_Queue_T.cpp | 4 | ||||
-rw-r--r-- | ace/Timer_Wheel_T.cpp | 6 |
9 files changed, 132 insertions, 43 deletions
diff --git a/ace/Acceptor.cpp b/ace/Acceptor.cpp index c65ea757193..298a32f64a9 100644 --- a/ace/Acceptor.cpp +++ b/ace/Acceptor.cpp @@ -51,10 +51,12 @@ ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::get_handle (void) const template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::open (const ACE_PEER_ACCEPTOR_ADDR &local_addr, - ACE_Reactor *reactor) + ACE_Reactor *reactor, + int flags) { ACE_TRACE ("ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::open"); this->reactor (reactor); + this->flags_ = flags; // Must supply a valid Reactor to Acceptor::open()... @@ -84,10 +86,11 @@ ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Acceptor (ACE_Reactor *react template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Acceptor (const ACE_PEER_ACCEPTOR_ADDR &addr, - ACE_Reactor *reactor) + ACE_Reactor *reactor, + int flags) { ACE_TRACE ("ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Acceptor"); - if (this->open (addr, reactor) == -1) + if (this->open (addr, reactor, flags) == -1) ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Acceptor::ACE_Acceptor")); } @@ -231,7 +234,18 @@ ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::activate_svc_handler (SVC_HANDLER *svc_handler) { ACE_TRACE ("ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::activate_svc_handler"); - if (svc_handler->open ((void *) this) == -1) + + // 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) + return -1; + } + // Otherwise, make sure it's disabled by default. + else if (svc_handler->peer ().disable (ACE_NONBLOCK) == -1) + return -1; + else if (svc_handler->open ((void *) this) == -1) { svc_handler->close (0); return -1; diff --git a/ace/Acceptor.h b/ace/Acceptor.h index 2a6c6d7da3e..bae7562abea 100644 --- a/ace/Acceptor.h +++ b/ace/Acceptor.h @@ -52,14 +52,24 @@ public: // "Do-nothing" constructor. ACE_Acceptor (const ACE_PEER_ACCEPTOR_ADDR &local_addr, - ACE_Reactor * = ACE_Service_Config::reactor ()); + ACE_Reactor * = ACE_Service_Config::reactor (), + int flags = 0); // Initialize and register <this> with the Reactor and listen for - // connection requests at the designated <local_addr>. + // connection requests at the designated <local_addr>. <flags> + // indicates how <SVC_HANDLER>'s should be initialized prior to + // being activated. Right now, the only flag that is processed is + // <ACE_NONBLOCK>, which enabled non-blocking I/O on the + // <SVC_HANDLER> when it is opened. int open (const ACE_PEER_ACCEPTOR_ADDR &, - ACE_Reactor * = ACE_Service_Config::reactor ()); + ACE_Reactor * = ACE_Service_Config::reactor (), + int flags = 0); // Initialize and register <this> with the Reactor and listen for - // connection requests at the designated <local_addr>. + // connection requests at the designated <local_addr>. <flags> + // indicates how <SVC_HANDLER>'s should be initialized prior to + // being activated. Right now, the only flag that is processed is + // <ACE_NONBLOCK>, which enabled non-blocking I/O on the + // <SVC_HANDLER> when it is opened. virtual ~ACE_Acceptor (void); // Close down the Acceptor's resources. @@ -138,6 +148,12 @@ protected: private: ACE_PEER_ACCEPTOR peer_acceptor_; // Concrete factory for accepting connections from clients... + + int flags_; + // Flags that indicate how <SVC_HANDLER>'s should be initialized + // prior to being activated. Right now, the only flag that is + // processed is <ACE_NONBLOCK>, which enabled non-blocking I/O on + // the <SVC_HANDLER> when it is opened. }; template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> diff --git a/ace/Connector.cpp b/ace/Connector.cpp index 1fd3bdc14d5..d8d8140a769 100644 --- a/ace/Connector.cpp +++ b/ace/Connector.cpp @@ -21,6 +21,8 @@ ACE_Connector<SH, PR_CO_2>::dump (void) const ACE_TRACE ("ACE_Connector<SH, PR_CO_2>::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, "\nclosing_ = %d", this->closing_)); + ACE_DEBUG ((LM_DEBUG, "\nflags_ = %d", this->flags_)); this->handler_map_.dump (); this->connector_.dump (); ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); @@ -49,10 +51,22 @@ ACE_Connector<SH, PR_CO_2>::activate_svc_handler (SVC_HANDLER *svc_handler) { ACE_TRACE ("ACE_Connector<SH, PR_CO_2>::activate_svc_handler"); + // 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) + return -1; + } + // Otherwise, make sure it's disabled by default. + else if (svc_handler->peer ().disable (ACE_NONBLOCK) == -1) + return -1; + // We are connected now, so try to open things up. - if (svc_handler->open ((void *) this) == -1) + else if (svc_handler->open ((void *) this) == -1) { - // Make sure to close down the Channel to avoid descriptor leaks. + // Make sure to close down the <svc_handler> to avoid descriptor + // leaks. svc_handler->close (0); return -1; } @@ -84,19 +98,20 @@ ACE_Connector<SH, PR_CO_2>::connector (void) const } template <class SH, PR_CO_1> int -ACE_Connector<SH, PR_CO_2>::open (ACE_Reactor *r) +ACE_Connector<SH, PR_CO_2>::open (ACE_Reactor *r, int flags) { ACE_TRACE ("ACE_Connector<SH, PR_CO_2>::open"); this->reactor (r); + this->flags_ = flags; this->closing_ = 0; return 0; } template <class SH, PR_CO_1> -ACE_Connector<SH, PR_CO_2>::ACE_Connector (ACE_Reactor *r) +ACE_Connector<SH, PR_CO_2>::ACE_Connector (ACE_Reactor *r, int flags) { ACE_TRACE ("ACE_Connector<SH, PR_CO_2>::ACE_Connector"); - (void) this->open (r); + (void) this->open (r, flags); } // Register the SVC_HANDLER with the map of pending connections so @@ -556,12 +571,17 @@ ACE_Strategy_Connector<SH, PR_CO_2>::open (ACE_Reactor *r, ACE_Creation_Strategy<SVC_HANDLER> *cre_s, ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> *conn_s, - ACE_Concurrency_Strategy<SVC_HANDLER> *con_s) + ACE_Concurrency_Strategy<SVC_HANDLER> *con_s, + int flags) { ACE_TRACE ("ACE_Connector<SH, PR_CO_2>::open"); this->reactor (r); + // @@ Not implemented yet. + // this->flags_ = flags; + ACE_UNUSED_ARG (flags); + // Initialize the creation strategy. if (cre_s == 0) @@ -597,7 +617,8 @@ ACE_Strategy_Connector<SH, PR_CO_2>::ACE_Strategy_Connector (ACE_Reactor *reactor, ACE_Creation_Strategy<SVC_HANDLER> *cre_s, ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> *conn_s, - ACE_Concurrency_Strategy<SVC_HANDLER> *con_s) + ACE_Concurrency_Strategy<SVC_HANDLER> *con_s, + int flags) : creation_strategy_ (0), delete_creation_strategy_ (0), connect_strategy_ (0), @@ -607,7 +628,7 @@ ACE_Strategy_Connector<SH, PR_CO_2>::ACE_Strategy_Connector { ACE_TRACE ("ACE_Connector<SH, PR_CO_2>::ACE_Connector"); - if (this->open (reactor, cre_s, conn_s, con_s) == -1) + if (this->open (reactor, cre_s, conn_s, con_s, flags) == -1) ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Strategy_Connector::ACE_Strategy_Connector")); } @@ -648,9 +669,13 @@ ACE_Strategy_Connector<SH, PR_CO_2>::connect_svc_handler int flags, int perms) { - return this->connect_strategy_->connect_svc_handler (sh, remote_addr, - timeout, local_addr, - reuse_addr, flags, perms); + return this->connect_strategy_->connect_svc_handler (sh, + remote_addr, + timeout, + local_addr, + reuse_addr, + flags, + perms); } template <class SH, PR_CO_1> int diff --git a/ace/Connector.h b/ace/Connector.h index bfe0af40ccd..4085937db45 100644 --- a/ace/Connector.h +++ b/ace/Connector.h @@ -109,11 +109,20 @@ public: typedef ACE_PEER_CONNECTOR_ADDR ACE_PEER_ADDR_TYPEDEF; #endif /* ACE_HAS_TYPENAME_KEYWORD */ - ACE_Connector (ACE_Reactor *r = ACE_Service_Config::reactor ()); - // Initialize a connector. + ACE_Connector (ACE_Reactor *r = ACE_Service_Config::reactor (), + int flags = 0); + // Initialize a connector. <flags> indicates how <SVC_HANDLER>'s + // should be initialized prior to being activated. Right now, the + // only flag that is processed is <ACE_NONBLOCK>, which enabled + // non-blocking I/O on the <SVC_HANDLER> when it is opened. - virtual int open (ACE_Reactor *r = ACE_Service_Config::reactor ()); - // Initialize a connector. + + virtual int open (ACE_Reactor *r = ACE_Service_Config::reactor (), + int flags = 0); + // Initialize a connector. <flags> indicates how <SVC_HANDLER>'s + // should be initialized prior to being activated. Right now, the + // only flag that is processed is <ACE_NONBLOCK>, which enabled + // non-blocking I/O on the <SVC_HANDLER> when it is opened. virtual ~ACE_Connector (void); // Shutdown a connector and release resources. @@ -252,6 +261,12 @@ private: char closing_; // Keeps track of whether we are in the process of closing (required // to avoid circular calls to <handle_close>). + + int flags_; + // Flags that indicate how <SVC_HANDLER>'s should be initialized + // prior to being activated. Right now, the only flag that is + // processed is <ACE_NONBLOCK>, which enabled non-blocking I/O on + // the <SVC_HANDLER> when it is opened. }; template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> @@ -273,14 +288,22 @@ public: ACE_Strategy_Connector (ACE_Reactor *r = ACE_Service_Config::reactor (), ACE_Creation_Strategy<SVC_HANDLER> * = 0, ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> * = 0, - ACE_Concurrency_Strategy<SVC_HANDLER> * = 0); - // Initialize a connector. + ACE_Concurrency_Strategy<SVC_HANDLER> * = 0, + int flags = 0); + // Initialize a connector. <flags> indicates how <SVC_HANDLER>'s + // should be initialized prior to being activated. Right now, the + // only flag that is processed is <ACE_NONBLOCK>, which enabled + // non-blocking I/O on the <SVC_HANDLER> when it is opened. virtual int open (ACE_Reactor *r = ACE_Service_Config::reactor (), ACE_Creation_Strategy<SVC_HANDLER> * = 0, ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> * = 0, - ACE_Concurrency_Strategy<SVC_HANDLER> * = 0); - // Initialize a connector. + ACE_Concurrency_Strategy<SVC_HANDLER> * = 0, + int flags = 0); + // Initialize a connector. <flags> indicates how <SVC_HANDLER>'s + // should be initialized prior to being activated. Right now, the + // only flag that is processed is <ACE_NONBLOCK>, which enabled + // non-blocking I/O on the <SVC_HANDLER> when it is opened. virtual ~ACE_Strategy_Connector (void); // Shutdown a connector and release resources. @@ -349,7 +372,6 @@ protected: int delete_concurrency_strategy_; // 1 if <Connector> created the concurrency strategy and thus should // delete it, else 0. - }; #include "ace/Connector.i" diff --git a/ace/Strategies_T.cpp b/ace/Strategies_T.cpp index 657be2fc0cc..34e484b1133 100644 --- a/ace/Strategies_T.cpp +++ b/ace/Strategies_T.cpp @@ -261,12 +261,24 @@ ACE_Reactive_Strategy<SVC_HANDLER>::activate_svc_handler (SVC_HANDLER *svc_handl if (this->reactor_ == 0) return -1; + + // See if we should enable non-blocking I/O on the <svc_handler>'s + // peer. + else if (ACE_BIT_ENABLED (this->flags_, ACE_NONBLOCK) != 0) + { + if (svc_handler->peer ().enable (ACE_NONBLOCK) == -1) + return -1; + } + // Otherwise, make sure it's disabled by default. + else if (svc_handler->peer ().disable (ACE_NONBLOCK) == -1) + return -1; + + // Register with the Reactor with the appropriate <mask>. else if (this->reactor_->register_handler (svc_handler, this->mask_) == -1) return -1; + // Call up to our parent to do the SVC_HANDLER initialization. - else if (this->inherited::activate_svc_handler (svc_handler, arg) == -1 - || (ACE_BIT_ENABLED (this->flags_, ACE_NONBLOCK) != 0 - && svc_handler->peer ().enable (ACE_NONBLOCK) == -1)) + else if (this->inherited::activate_svc_handler (svc_handler, arg) == -1) { // Make sure to remove the <svc_handler> from the <Reactor>. this->reactor_->remove_handler (svc_handler, this->mask_); diff --git a/ace/Timer_Heap_T.cpp b/ace/Timer_Heap_T.cpp index c00202de362..3983b8460c7 100644 --- a/ace/Timer_Heap_T.cpp +++ b/ace/Timer_Heap_T.cpp @@ -442,7 +442,7 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, LOCK>::schedule (const TYPE &type, { ACE_TRACE ("ACE_Timer_Heap::schedule"); - ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->lock_, -1)); + ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->mutex_, -1)); if (this->cur_size_ < this->max_size_) { @@ -479,7 +479,7 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, LOCK>::cancel (long timer_id, int dont_call) { ACE_TRACE ("ACE_Timer_Heap::cancel"); - ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->lock_, -1)); + ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->mutex_, -1)); // Locate the ACE_Timer_Node that corresponds to the timer_id. @@ -513,7 +513,7 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, LOCK>::cancel (const TYPE &type, int dont_call) { ACE_TRACE ("ACE_Timer_Heap::cancel"); - ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->lock_, -1)); + ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->mutex_, -1)); int number_of_cancellations = 0; diff --git a/ace/Timer_List_T.cpp b/ace/Timer_List_T.cpp index 6507c98bbb6..3aecb92845e 100644 --- a/ace/Timer_List_T.cpp +++ b/ace/Timer_List_T.cpp @@ -87,7 +87,7 @@ template <class TYPE, class FUNCTOR, class LOCK> ACE_Timer_List_T<TYPE, FUNCTOR, LOCK>::~ACE_Timer_List_T (void) { ACE_TRACE ("ACE_Timer_List::~ACE_Timer_List"); - ACE_MT (ACE_GUARD (LOCK, ace_mon, this->lock_)); + ACE_MT (ACE_GUARD (LOCK, ace_mon, this->mutex_)); ACE_Timer_Node_T<TYPE, FUNCTOR, LOCK> *curr = this->head_; @@ -154,7 +154,7 @@ ACE_Timer_List_T<TYPE, FUNCTOR, LOCK>::schedule (const TYPE &type, const ACE_Time_Value &interval) { ACE_TRACE ("ACE_Timer_List::schedule"); - ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->lock_, -1)); + ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->mutex_, -1)); // Increment the sequence number (it will wrap around). long timer_id = this->timer_id (); @@ -224,7 +224,7 @@ ACE_Timer_List_T<TYPE, FUNCTOR, LOCK>::cancel (long timer_id, int dont_call) { ACE_TRACE ("ACE_Timer_List::cancel"); - ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->lock_, -1)); + ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->mutex_, -1)); ACE_Timer_Node_T<TYPE, FUNCTOR, LOCK> *prev = 0; ACE_Timer_Node_T<TYPE, FUNCTOR, LOCK> *curr = 0; @@ -263,7 +263,7 @@ ACE_Timer_List_T<TYPE, FUNCTOR, LOCK>::cancel (const TYPE &type, int dont_call) { ACE_TRACE ("ACE_Timer_List::cancel"); - ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->lock_, -1)); + ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->mutex_, -1)); ACE_Timer_Node_T<TYPE, FUNCTOR, LOCK> *prev = 0; ACE_Timer_Node_T<TYPE, FUNCTOR, LOCK> *curr = this->head_; diff --git a/ace/Timer_Queue_T.cpp b/ace/Timer_Queue_T.cpp index 8fa83172d9c..e0aec3b7e9c 100644 --- a/ace/Timer_Queue_T.cpp +++ b/ace/Timer_Queue_T.cpp @@ -95,7 +95,7 @@ template <class TYPE, class FUNCTOR, class LOCK> ACE_Time_Value * ACE_Timer_Queue_T<TYPE, FUNCTOR, LOCK>::calculate_timeout (ACE_Time_Value *max_wait_time) { ACE_TRACE ("ACE_Timer_List::calculate_timeout"); - ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->lock_, max_wait_time)); + ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->mutex_, max_wait_time)); if (this->is_empty ()) // Nothing on the Timer_Queue, so use whatever the caller gave us. @@ -165,7 +165,7 @@ template <class TYPE, class FUNCTOR, class LOCK> int ACE_Timer_Queue_T<TYPE, FUNCTOR, LOCK>::expire (const ACE_Time_Value &cur_time) { ACE_TRACE ("ACE_Timer_List::expire"); - ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->lock_, -1)); + ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->mutex_, -1)); int number_of_timers_expired = 0; diff --git a/ace/Timer_Wheel_T.cpp b/ace/Timer_Wheel_T.cpp index 61129ada571..99d597f18e7 100644 --- a/ace/Timer_Wheel_T.cpp +++ b/ace/Timer_Wheel_T.cpp @@ -165,7 +165,7 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, LOCK>::schedule (const TYPE &type, const ACE_Time_Value &interval) { ACE_TRACE ("ACE_Timer_Wheel_T::schedule"); - ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->lock_, -1)); + ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->mutex_, -1)); ACE_Timer_Node_T<TYPE, FUNCTOR, LOCK> *tempnode = this->alloc_node (); @@ -196,7 +196,7 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, LOCK>::cancel (const TYPE &type, int dont_call_handle_close) { ACE_TRACE ("ACE_Timer_Wheel_T::cancel"); - ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->lock_, -1)); + ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->mutex_, -1)); int number_of_cancellations = 0; @@ -238,7 +238,7 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, LOCK>::cancel (long timer_id, int dont_call_handle_close) { ACE_TRACE ("ACE_Timer_Wheel_T::cancel"); - ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->lock_, -1)); + ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->mutex_, -1)); ACE_Timer_Node_T<TYPE, FUNCTOR, LOCK> *node = (ACE_Timer_Node_T<TYPE, FUNCTOR, LOCK> *) timer_id; |