diff options
author | bala <balanatarajan@users.noreply.github.com> | 2000-08-09 13:58:34 +0000 |
---|---|---|
committer | bala <balanatarajan@users.noreply.github.com> | 2000-08-09 13:58:34 +0000 |
commit | 4306535e98a101081144186a0c70c35d26b0dcb8 (patch) | |
tree | 6f2cb0f5dd0348134fdc0e669d3d31f758ee498f | |
parent | fdd52a986526b6c5db890c50565c7aeb12ba806f (diff) | |
download | ATCD-4306535e98a101081144186a0c70c35d26b0dcb8.tar.gz |
*** empty log message ***
-rw-r--r-- | TAO/tao/ORB.cpp | 1 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.cpp | 1 | ||||
-rw-r--r-- | TAO/tao/TAO_Singleton_Manager.cpp | 58 |
3 files changed, 42 insertions, 18 deletions
diff --git a/TAO/tao/ORB.cpp b/TAO/tao/ORB.cpp index 1fa8deec50e..5746a8c9f5b 100644 --- a/TAO/tao/ORB.cpp +++ b/TAO/tao/ORB.cpp @@ -5,6 +5,7 @@ #include "ace/Dynamic_Service.h" #include "ace/Service_Repository.h" +#include "ace/Object_Manager.h" #include "ace/SOCK_Dgram_Mcast.h" #include "ace/SOCK_Acceptor.h" #include "ace/Thread_Manager.h" diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index ad5c0b9a256..202163b22e1 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -26,6 +26,7 @@ #include "tao/Priority_Mapping_Manager.h" #include "tao/RT_Current.h" +#include "ace/Object_Manager.h" #include "ace/Env_Value_T.h" #include "ace/Dynamic_Service.h" #include "ace/Arg_Shifter.h" diff --git a/TAO/tao/TAO_Singleton_Manager.cpp b/TAO/tao/TAO_Singleton_Manager.cpp index aa1d8d9148e..b82b3065a28 100644 --- a/TAO/tao/TAO_Singleton_Manager.cpp +++ b/TAO/tao/TAO_Singleton_Manager.cpp @@ -1,5 +1,6 @@ // $Id$ +#include "ace/Object_Manager.h" #include "ace/Log_Msg.h" #include "ace/Synch.h" @@ -31,7 +32,7 @@ TAO_Singleton_Manager::TAO_Singleton_Manager (void) // default_mask_ isn't initialized, because it's defined by <init>. : thread_hook_ (0), exit_info_ (), - registered_with_object_manager_ (0) + registered_with_object_manager_ (-1) #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) , internal_lock_ (new ACE_Recursive_Thread_Mutex) # endif /* ACE_MT_SAFE */ @@ -40,7 +41,12 @@ TAO_Singleton_Manager::TAO_Singleton_Manager (void) if (instance_ == 0) instance_ = this; - (void) this->init (); + // @@ This is a hack. Allow the TAO_Singleton_Manager to be registered + // with the ACE_Object_Manager (or not) in an explicit call to + // TAO_Singleton_Manager::init(). However, once the explicit call is + // made, it will not be possible to alter the setting. + int register_with_object_manager = -1; + (void) this->init (register_with_object_manager); } TAO_Singleton_Manager::~TAO_Singleton_Manager (void) @@ -87,7 +93,6 @@ TAO_Singleton_Manager::instance (void) ACE_ASSERT (instance_pointer == instance_); instance_pointer->dynamically_allocated_ = 1; - } return instance_; @@ -96,10 +101,16 @@ TAO_Singleton_Manager::instance (void) int TAO_Singleton_Manager::init (void) { - // Register the TAO_Singleton_Manager with the ACE_Object_Manager. - int register_with_object_manager = 1; + if (this->registered_with_object_manager_ == -1) + { + // Register the TAO_Singleton_Manager with the + // ACE_Object_Manager. + int register_with_object_manager = 1; + + return this->init (register_with_object_manager); + } - return this->init (register_with_object_manager); + return 1; // Already initialized. } int @@ -121,24 +132,22 @@ TAO_Singleton_Manager::init (int register_with_object_manager) ACE_NEW_RETURN (this->default_mask_, sigset_t, -1); ACE_OS::sigfillset (this->default_mask_); - if (register_with_object_manager == 1 - && ACE_Object_Manager::instance ()->at_exit ( - this, - (ACE_CLEANUP_FUNC) TAO_Singleton_Manager_cleanup_destroyer, - 0) != 0) - return -1; - - this->registered_with_object_manager_ = - register_with_object_manager; - // Finally, indicate that the TAO_Singleton_Manager instance has // been initialized. this->object_manager_state_ = OBJ_MAN_INITIALIZED; return 0; } - else if (this->registered_with_object_manager_ - != register_with_object_manager) + + // @@ This strange looking code is what provides the "register on + // explicit call to init()" semantics. This was needed since the + // TAO_Singleton_Manager constructor invokes init(). + // Unfortunately, I couldn't get rid of that init() call without + // breaking things. The fact things broke needs to be + // investigated further. + if (this->registered_with_object_manager_ != -1 + && register_with_object_manager + != this->registered_with_object_manager_) { // An attempt was made to register the TAO_Singleton_Manager // with a manager of a different type from the one it is @@ -149,6 +158,19 @@ TAO_Singleton_Manager::init (int register_with_object_manager) return -1; } + if (this->registered_with_object_manager_ == -1) + { + if (register_with_object_manager == 1 + && ACE_Object_Manager::at_exit ( + this, + (ACE_CLEANUP_FUNC) TAO_Singleton_Manager_cleanup_destroyer, + 0) != 0) + return -1; + + this->registered_with_object_manager_ = + register_with_object_manager; + } + // Had already initialized. return 1; } |