diff options
-rw-r--r-- | TAO/tao/ChangeLog | 13 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.cpp | 65 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.h | 19 | ||||
-rw-r--r-- | TAO/tao/Thread_Lane_Resources.cpp | 89 | ||||
-rw-r--r-- | TAO/tao/Thread_Lane_Resources.h | 37 |
5 files changed, 143 insertions, 80 deletions
diff --git a/TAO/tao/ChangeLog b/TAO/tao/ChangeLog new file mode 100644 index 00000000000..4756f37d14a --- /dev/null +++ b/TAO/tao/ChangeLog @@ -0,0 +1,13 @@ +Thu Jul 25 07:17:02 2002 Balachandran Natarajan <bala@cs.wustl.edu> + + * tao/ORB_Core.h: + * tao/ORB_Core.cpp: + * tao/Thread_Lane_Resources.h: + * tao/Thread_Lane_Resources.cpp (finalize): Moved the allocators, + used to create the InputCDR allocators like the data_block + allocator, message_block allocator, buffer allocator and the + allocator used for buffering messages in the transport object + from the ORB_Core to the lanes. Since these allocators are + global, sharing the allocators across threads in multiple lanes + could lead to jitter. + diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index e636d96c696..fd04044c019 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -2146,49 +2146,22 @@ TAO_ORB_Core::list_initial_references (ACE_ENV_SINGLE_ARG_DECL) } // **************************************************************** - ACE_Allocator* TAO_ORB_Core::input_cdr_dblock_allocator (void) { - if (this->orb_resources_.input_cdr_dblock_allocator_ == 0) - { - // Double checked locking - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); - if (this->orb_resources_.input_cdr_dblock_allocator_ == 0) - this->orb_resources_.input_cdr_dblock_allocator_ = - this->resource_factory ()->input_cdr_dblock_allocator (); - } - return this->orb_resources_.input_cdr_dblock_allocator_; + return this->lane_resources ().input_cdr_dblock_allocator (); } - ACE_Allocator* TAO_ORB_Core::input_cdr_buffer_allocator (void) { - if (this->orb_resources_.input_cdr_buffer_allocator_ == 0) - { - // Double checked locking - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); - if (this->orb_resources_.input_cdr_buffer_allocator_ == 0) - this->orb_resources_.input_cdr_buffer_allocator_ = - this->resource_factory ()->input_cdr_buffer_allocator (); - } - return this->orb_resources_.input_cdr_buffer_allocator_; + return this->lane_resources ().input_cdr_buffer_allocator (); } - ACE_Allocator* TAO_ORB_Core::input_cdr_msgblock_allocator (void) { - if (this->orb_resources_.input_cdr_msgblock_allocator_ == 0) - { - // Double checked locking - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); - if (this->orb_resources_.input_cdr_msgblock_allocator_ == 0) - this->orb_resources_.input_cdr_msgblock_allocator_ = - this->resource_factory ()->input_cdr_msgblock_allocator (); - } - return this->orb_resources_.input_cdr_msgblock_allocator_; + return this->lane_resources ().input_cdr_msgblock_allocator (); } ACE_Allocator* @@ -2250,18 +2223,10 @@ TAO_ORB_Core::output_cdr_msgblock_allocator (void) } -ACE_Allocator* +ACE_Allocator * TAO_ORB_Core::transport_message_buffer_allocator (void) { - if (this->orb_resources_.transport_message_buffer_allocator_ == 0) - { - // Double checked locking - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); - if (this->orb_resources_.transport_message_buffer_allocator_ == 0) - this->orb_resources_.transport_message_buffer_allocator_ = - this->resource_factory ()->input_cdr_dblock_allocator (); - } - return this->orb_resources_.transport_message_buffer_allocator_; + return this->lane_resources ().transport_message_buffer_allocator (); } @@ -2656,10 +2621,6 @@ TAO_ORB_Core_TSS_Resources::TAO_ORB_Core_TSS_Resources (void) : output_cdr_dblock_allocator_ (0), output_cdr_buffer_allocator_ (0), output_cdr_msgblock_allocator_ (0), - input_cdr_dblock_allocator_ (0), - input_cdr_buffer_allocator_ (0), - input_cdr_msgblock_allocator_ (0), - transport_message_buffer_allocator_ (0), event_loop_thread_ (0), client_leader_thread_ (0), lane_ (0), @@ -2690,22 +2651,6 @@ TAO_ORB_Core_TSS_Resources::~TAO_ORB_Core_TSS_Resources (void) this->output_cdr_msgblock_allocator_->remove (); delete this->output_cdr_msgblock_allocator_; - if (this->input_cdr_dblock_allocator_ != 0) - this->input_cdr_dblock_allocator_->remove (); - delete this->input_cdr_dblock_allocator_; - - if (this->input_cdr_buffer_allocator_ != 0) - this->input_cdr_buffer_allocator_->remove (); - delete this->input_cdr_buffer_allocator_; - - if (this->input_cdr_msgblock_allocator_ != 0) - this->input_cdr_msgblock_allocator_->remove (); - delete this->input_cdr_msgblock_allocator_; - - if (this->transport_message_buffer_allocator_ != 0) - this->transport_message_buffer_allocator_->remove (); - delete this->transport_message_buffer_allocator_; - #if TAO_HAS_INTERCEPTORS == 1 CORBA::release (this->client_request_info_); #endif /* TAO_HAS_INTERCEPTORS == 1 */ diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h index f084e6e0319..f6249e3e772 100644 --- a/TAO/tao/ORB_Core.h +++ b/TAO/tao/ORB_Core.h @@ -126,12 +126,7 @@ private: public: - /* - * @@todo: All these allocators should be on a per-lane basis. Need - * to move it to the lanes. It makes no sense to leave it in the TSS - * resources class -- Bala - * - */ + /// The allocators for the output CDR streams. //@{ ACE_Allocator *output_cdr_dblock_allocator_; @@ -139,18 +134,6 @@ public: ACE_Allocator *output_cdr_msgblock_allocator_; //@} - /// The allocators for the input CDR streams. - //@{ - ACE_Allocator *input_cdr_dblock_allocator_; - ACE_Allocator *input_cdr_buffer_allocator_; - ACE_Allocator *input_cdr_msgblock_allocator_; - //@} - - /// The allocators for the buffering messages in the transport. - //@{ - ACE_Allocator *transport_message_buffer_allocator_; - //@} - /** * @todo * The rest of the resources are not currently in use, just a plan diff --git a/TAO/tao/Thread_Lane_Resources.cpp b/TAO/tao/Thread_Lane_Resources.cpp index 8275653b391..c66f1c2a964 100644 --- a/TAO/tao/Thread_Lane_Resources.cpp +++ b/TAO/tao/Thread_Lane_Resources.cpp @@ -23,7 +23,11 @@ TAO_Thread_Lane_Resources::TAO_Thread_Lane_Resources (TAO_ORB_Core &orb_core, connector_registry_ (0), transport_cache_ (0), leader_follower_ (0), - new_leader_generator_ (new_leader_generator) + new_leader_generator_ (new_leader_generator), + input_cdr_dblock_allocator_ (0), + input_cdr_buffer_allocator_ (0), + input_cdr_msgblock_allocator_ (0), + transport_message_buffer_allocator_ (0) { // Create the transport cache. ACE_NEW (this->transport_cache_, @@ -151,6 +155,67 @@ TAO_Thread_Lane_Resources::leader_follower (void) } +ACE_Allocator* +TAO_Thread_Lane_Resources::input_cdr_dblock_allocator (void) +{ + if (this->input_cdr_dblock_allocator_ == 0) + { + // Double checked locking + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); + if (this->input_cdr_dblock_allocator_ == 0) + this->input_cdr_dblock_allocator_ = + this->resource_factory ()->input_cdr_dblock_allocator (); + } + + return this->input_cdr_dblock_allocator_; +} + + +ACE_Allocator* +TAO_Thread_Lane_Resources::input_cdr_buffer_allocator (void) +{ + if (this->input_cdr_buffer_allocator_ == 0) + { + // Double checked locking + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); + if (this->input_cdr_buffer_allocator_ == 0) + this->input_cdr_buffer_allocator_ = + this->resource_factory ()->input_cdr_buffer_allocator (); + } + + return this->input_cdr_buffer_allocator_; +} + + +ACE_Allocator* +TAO_Thread_Lane_Resources::input_cdr_msgblock_allocator (void) +{ + if (this->input_cdr_msgblock_allocator_ == 0) + { + // Double checked locking + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); + if (this->input_cdr_msgblock_allocator_ == 0) + this->input_cdr_msgblock_allocator_ = + this->resource_factory ()->input_cdr_msgblock_allocator (); + } + + return this->input_cdr_msgblock_allocator_; +} + +ACE_Allocator* +TAO_Thread_Lane_Resources::transport_message_buffer_allocator (void) +{ + if (this->transport_message_buffer_allocator_ == 0) + { + // Double checked locking + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); + if (this->transport_message_buffer_allocator_ == 0) + this->transport_message_buffer_allocator_ = + this->resource_factory ()->input_cdr_dblock_allocator (); + } + + return this->transport_message_buffer_allocator_; +} int TAO_Thread_Lane_Resources::open_acceptor_registry (int ignore_address @@ -171,6 +236,12 @@ TAO_Thread_Lane_Resources::open_acceptor_registry (int ignore_address return result; } +TAO_Resource_Factory * +TAO_Thread_Lane_Resources::resource_factory (void) +{ + return this->orb_core_.resource_factory (); +} + void TAO_Thread_Lane_Resources::finalize (void) { @@ -189,6 +260,22 @@ TAO_Thread_Lane_Resources::finalize (void) delete this->acceptor_registry_; } + if (this->input_cdr_dblock_allocator_ != 0) + this->input_cdr_dblock_allocator_->remove (); + delete this->input_cdr_dblock_allocator_; + + if (this->input_cdr_buffer_allocator_ != 0) + this->input_cdr_buffer_allocator_->remove (); + delete this->input_cdr_buffer_allocator_; + + if (this->input_cdr_msgblock_allocator_ != 0) + this->input_cdr_msgblock_allocator_->remove (); + delete this->input_cdr_msgblock_allocator_; + + if (this->transport_message_buffer_allocator_ != 0) + this->transport_message_buffer_allocator_->remove (); + delete this->transport_message_buffer_allocator_; + // Set of file descriptors corresponding to open connections. This // handle set is used to explicitly deregister the connection event // handlers from the Reactor. This is particularly important for diff --git a/TAO/tao/Thread_Lane_Resources.h b/TAO/tao/Thread_Lane_Resources.h index 4cbdbc41585..2a3f89b268e 100644 --- a/TAO/tao/Thread_Lane_Resources.h +++ b/TAO/tao/Thread_Lane_Resources.h @@ -30,7 +30,7 @@ class TAO_Leader_Follower; class TAO_MProfile; class TAO_New_Leader_Generator; class TAO_Connector_Registry; - +class TAO_Resource_Factory; /** * @class TAO_Thread_Lane_Resources * @@ -77,6 +77,25 @@ public: TAO_Leader_Follower &leader_follower (void); + /* Allocator is intended for allocating the ACE_Data_Blocks used in + * incoming CDR streams. This allocator has locks. + */ + ACE_Allocator *input_cdr_dblock_allocator (void); + + /* Allocator is intended for allocating the buffers in the incoming + * CDR streams. This allocator has locks. + */ + ACE_Allocator *input_cdr_buffer_allocator (void); + + /* Allocator is intended for allocating the ACE_Message_Blocks used + * in incoming CDR streams. This allocator is global, and has locks. + */ + ACE_Allocator *input_cdr_msgblock_allocator (void); + + /* Allocator is intended for allocating the buffers used in the + * Transport object. This allocator has locks. + */ + ACE_Allocator *transport_message_buffer_allocator (void); // @} private: @@ -84,6 +103,10 @@ private: /// Checks if the acceptor registry has been created. int has_acceptor_registry_been_created (void) const; + /// Helper to get the resource factory in the ORB_Core + TAO_Resource_Factory *resource_factory (void); + +private: /// ORB_Core related to this thread lane. TAO_ORB_Core &orb_core_; @@ -106,6 +129,18 @@ private: /// Generator of new leader threads. TAO_New_Leader_Generator *new_leader_generator_; + + /// The allocators for the input CDR streams. + //@{ + ACE_Allocator *input_cdr_dblock_allocator_; + ACE_Allocator *input_cdr_buffer_allocator_; + ACE_Allocator *input_cdr_msgblock_allocator_; + //@} + + /// The allocators for the buffering messages in the transport. + //@{ + ACE_Allocator *transport_message_buffer_allocator_; + //@} }; #if defined (__ACE_INLINE__) |