diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-03-01 19:15:33 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-03-01 19:15:33 +0000 |
commit | 1f75eb70a72bae885c665f3b91b73b13b836b491 (patch) | |
tree | c08cf828dea0abb4d47ebe6f9df3c58468866ce7 /ace/Object_Manager.cpp | |
parent | 0e81d140a777185bbc875526fc19d68a1dcea83f (diff) | |
download | ATCD-1f75eb70a72bae885c665f3b91b73b13b836b491.tar.gz |
added ACE_OS_Object_Manager
Diffstat (limited to 'ace/Object_Manager.cpp')
-rw-r--r-- | ace/Object_Manager.cpp | 296 |
1 files changed, 112 insertions, 184 deletions
diff --git a/ace/Object_Manager.cpp b/ace/Object_Manager.cpp index 9eb2fb5370f..cff66a9f4f6 100644 --- a/ace/Object_Manager.cpp +++ b/ace/Object_Manager.cpp @@ -4,9 +4,9 @@ #include "ace/Object_Manager.h" #include "ace/Token_Manager.h" -#if !defined (ACE_HAS_WINCE) +#if !defined (ACE_HAS_WINCE) && !defined (ACE_LACKS_ACE_OTHER) # include "ace/Naming_Context.h" -#endif /* !ACE_HAS_WINCE */ +#endif /* ! ACE_HAS_WINCE && ! ACE_LACKS_ACE_OTHER */ #include "ace/Service_Manager.h" #include "ace/Service_Config.h" #include "ace/Signal.h" @@ -39,14 +39,7 @@ ACE_RCSID(ace, Object_Manager, "$Id$") #endif /* ACE_APPLICATION_PREALLOCATED_ARRAY_DELETIONS */ // Singleton pointer. -static ACE_Object_Manager *ACE_Object_Manager_instance_ = 0; - -int ACE_Object_Manager::starting_up_ = 1; - -int ACE_Object_Manager::shutting_down_ = 0; - -u_int ACE_Object_Manager::initialized_ = 0; -// Flag to allow handling of multiple calls to init (). +ACE_Object_Manager *ACE_Object_Manager::instance_ = 0; void *ACE_Object_Manager::preallocated_object[ ACE_Object_Manager::ACE_PREALLOCATED_OBJECTS] = { 0 }; @@ -100,9 +93,9 @@ public: ~ACE_Object_Manager_Preallocations (void); private: -#if !defined (ACE_HAS_WINCE) +#if !defined (ACE_HAS_WINCE) && !defined (ACE_LACKS_ACE_OTHER) ACE_Static_Svc_Descriptor ace_svc_desc_ACE_Naming_Context; -#endif /* !ACE_HAS_WINCE */ +#endif /* ! ACE_HAS_WINCE && ! ACE_LACKS_ACE_OTHER */ ACE_Static_Svc_Descriptor ace_svc_desc_ACE_Service_Manager; }; @@ -113,19 +106,11 @@ extern "C" ACE_Export ACE_Service_Object * _make_ACE_Service_Manager (ACE_Service_Object_Exterminator *); -extern "C" -void -ACE_Object_Manager_Internal_Exit_Hook () -{ - if (ACE_Object_Manager_instance_) - ACE_Object_Manager_instance_->fini (); -} - ACE_Object_Manager_Preallocations::ACE_Object_Manager_Preallocations (void) { // Define the static services. This macro call creates static // service descriptors that are used for initialization below. -#if !defined (ACE_HAS_WINCE) +#if !defined (ACE_HAS_WINCE) && !defined (ACE_LACKS_ACE_OTHER) ACE_STATIC_SVC_DEFINE (ACE_Naming_Context_initializer, ASYS_TEXT ("ACE_Naming_Context"), ACE_SVC_OBJ_T, @@ -133,7 +118,7 @@ ACE_Object_Manager_Preallocations::ACE_Object_Manager_Preallocations (void) ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, 0) -#endif /* !ACE_HAS_WINCE */ +#endif /* ! ACE_HAS_WINCE && ! ACE_LACKS_ACE_OTHER */ ACE_STATIC_SVC_DEFINE (ACE_Service_Manager_initializer, ASYS_TEXT ("ACE_Service_Manager"), @@ -145,19 +130,19 @@ ACE_Object_Manager_Preallocations::ACE_Object_Manager_Preallocations (void) // Initialize the static service objects using the descriptors created // above. -#if !defined (ACE_HAS_WINCE) +#if !defined (ACE_HAS_WINCE) && !defined (ACE_LACKS_ACE_OTHER) ace_svc_desc_ACE_Naming_Context = ace_svc_desc_ACE_Naming_Context_initializer; -#endif /* !ACE_HAS_WINCE */ +#endif /* ! ACE_HAS_WINCE && ! ACE_LACKS_ACE_OTHER */ ace_svc_desc_ACE_Service_Manager = ace_svc_desc_ACE_Service_Manager_initializer; // Add to the list of static configured services. -#if !defined (ACE_HAS_WINCE) +#if !defined (ACE_HAS_WINCE) && !defined (ACE_LACKS_ACE_OTHER) ACE_Service_Config::static_svcs ()-> insert (&ace_svc_desc_ACE_Naming_Context); -#endif /* !ACE_HAS_WINCE */ +#endif /* ! ACE_HAS_WINCE && ! ACE_LACKS_ACE_OTHER */ ACE_Service_Config::static_svcs ()-> insert (&ace_svc_desc_ACE_Service_Manager); @@ -167,32 +152,18 @@ ACE_Object_Manager_Preallocations::~ACE_Object_Manager_Preallocations (void) { } -ACE_Object_Manager_Base::ACE_Object_Manager_Base (void) - : registered_objects_ (0) -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - , internal_lock_ (new ACE_Recursive_Thread_Mutex) - , singleton_null_lock_ (0) - , singleton_thread_locks_ (0) - , singleton_mutex_locks_ (0) - , singleton_recursive_lock_ (0) - , singleton_rw_locks_ (0) -# endif /* ACE_MT_SAFE */ -{ -} - int ACE_Object_Manager::init (void) { - if (initialized_ == 0) + if (object_manager_state_ < INITIALIZING_ACE_OBJ_MAN) { - initialized_ = 1; + // First, indicate that the ACE_Object_Manager instance is being + // initialized. + object_manager_state_ = INITIALIZING_ACE_OBJ_MAN; - if (ACE_Object_Manager_instance_ == 0) - { - // Allocate the ACE_Object_Manager instance on the heap. Assume - // that the application will call fini () to destroy it. - ACE_Object_Manager::instance (); - } + // Make sure that the ACE_OS_Object_Manager has been created, + // and register with it for chained fini (). + ACE_OS_Object_Manager::instance ()->next_ = this; // Allocate the preallocated (hard-coded) object instances. ACE_PREALLOCATE_OBJECT (ACE_SYNCH_RW_MUTEX, ACE_FILECACHE_LOCK) @@ -204,7 +175,6 @@ ACE_Object_Manager::init (void) ACE_PREALLOCATE_OBJECT (ACE_Thread_Mutex, ACE_LOG_MSG_INSTANCE_LOCK) ACE_PREALLOCATE_OBJECT (ACE_Thread_Mutex, ACE_MT_CORBA_HANDLER_LOCK) ACE_PREALLOCATE_OBJECT (ACE_Thread_Mutex, ACE_DUMP_LOCK) - ACE_PREALLOCATE_OBJECT (ACE_Thread_Mutex, ACE_OS_MONITOR_LOCK) ACE_PREALLOCATE_OBJECT (ACE_Recursive_Thread_Mutex, ACE_SIG_HANDLER_LOCK) ACE_PREALLOCATE_OBJECT (ACE_Null_Mutex, ACE_SINGLETON_NULL_LOCK) @@ -215,19 +185,12 @@ ACE_Object_Manager::init (void) ACE_TOKEN_MANAGER_CREATION_LOCK) ACE_PREALLOCATE_OBJECT (ACE_TOKEN_CONST::MUTEX, ACE_TOKEN_INVARIANTS_CREATION_LOCK) - ACE_PREALLOCATE_OBJECT (ACE_Recursive_Thread_Mutex, - ACE_TSS_CLEANUP_LOCK) -# if defined (ACE_HAS_TSS_EMULATION) && \ - defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) - ACE_PREALLOCATE_OBJECT (ACE_Recursive_Thread_Mutex, - ACE_TSS_BASE_LOCK) -# endif /* ACE_HAS_TSS_EMULATION && ACE_HAS_THREAD_SPECIFIC_STORAGE */ # endif /* ACE_MT_SAFE */ // Do this after the allocation of ACE_STATIC_OBJECT_LOCK. It // shouldn't matter, but just in case // ACE_Static_Object_Lock::instance () gets changed . . . - ACE_NEW_RETURN (ACE_Object_Manager_instance_->registered_objects_, + ACE_NEW_RETURN (registered_objects_, ACE_Unbounded_Queue<ACE_Cleanup_Info>, -1); // Hooks for preallocated objects and arrays provided by application. @@ -236,28 +199,19 @@ ACE_Object_Manager::init (void) # if defined (ACE_HAS_TSS_EMULATION) // Initialize the main thread's TS storage. - ACE_TSS_Emulation::tss_open ( - ACE_Object_Manager_instance_->ts_storage_); + ACE_TSS_Emulation::tss_open (ts_storage_); # endif /* ACE_HAS_TSS_EMULATION */ - // Open Winsock (no-op on other platforms). - ACE_OS::socket_init (ACE_WSOCK_VERSION); - - ACE_NEW_RETURN (ACE_Object_Manager_instance_->preallocations_, - ACE_Object_Manager_Preallocations, -1); + ACE_NEW_RETURN (preallocations_, ACE_Object_Manager_Preallocations, -1); // Open the main thread's ACE_Log_Msg. (void) ACE_LOG_MSG; - ACE_NEW_RETURN (ACE_Object_Manager_instance_->default_mask_, - ACE_Sig_Set (1), -1); - - // Register the exit hook, for use by ACE_OS::exit (). - ACE_OS::set_exit_hook (ACE_Object_Manager_Internal_Exit_Hook); + ACE_NEW_RETURN (default_mask_, ACE_Sig_Set (1), -1); // Finally, indicate that the ACE_Object_Manager instance has - // been constructed. - ACE_Object_Manager_instance_->starting_up_ = 0; + // been initialized. + object_manager_state_ = INITIALIZED_ACE_OBJ_MAN; return 0; } else { @@ -269,8 +223,7 @@ ACE_Object_Manager::init (void) int ACE_Object_Manager::fini (void) { - if (ACE_Object_Manager_instance_ == 0 || \ - ACE_Object_Manager_instance_->shutting_down_ == 1) + if (instance_ == 0 || object_manager_state_ >= SHUTTING_DOWN_ACE_OBJ_MAN) // Too late. Or, maybe too early. Either fini () has already // been called, or init () was never called. return -1; @@ -278,10 +231,9 @@ ACE_Object_Manager::fini (void) // No mutex here. Only the main thread should destroy the singleton // ACE_Object_Manager instance. - // First, indicate that the ACE_Object_Manager instance is (being) - // destroyed. If an object tries to register after this, it will be - // refused. - ACE_Object_Manager_instance_->shutting_down_ = 1; + // First, indicate that the ACE_Object_Manager instance is being + // shut down. + object_manager_state_ = SHUTTING_DOWN_ACE_OBJ_MAN; ACE_Trace::stop_tracing (); @@ -293,9 +245,8 @@ ACE_Object_Manager::fini (void) // Call all registered cleanup hooks, in reverse order of // registration. - while (ACE_Object_Manager_instance_->registered_objects_ && - ACE_Object_Manager_instance_->registered_objects_-> - dequeue_head (info) != -1) + while (registered_objects_ && + registered_objects_->dequeue_head (info) != -1) { if (info.cleanup_hook_ == (ACE_CLEANUP_FUNC) ace_cleanup_destroyer) // The object is an ACE_Cleanup. @@ -315,11 +266,8 @@ ACE_Object_Manager::fini (void) // all ACE library services and singletons. ACE_Service_Config::close (); - // Close down Winsock (no-op on other platforms). - ACE_OS::socket_fini (); - - delete ACE_Object_Manager_instance_->preallocations_; - ACE_Object_Manager_instance_->preallocations_ = 0; + delete preallocations_; + preallocations_ = 0; // Close the ACE_Allocator. ACE_Allocator::close_singleton (); @@ -328,16 +276,16 @@ ACE_Object_Manager::fini (void) // Hooks for deletion of preallocated objects and arrays provided by // application. ACE_APPLICATION_PREALLOCATED_ARRAY_DELETIONS - ACE_APPLICATION_PREALLOCATED_OBJECT_DELETIONS + ACE_APPLICATION_PREALLOCATED_OBJECT_DELETIONS - // Cleanup the dynamically preallocated arrays. - // (none) + // Cleanup the dynamically preallocated arrays. + // (none) - // Cleanup the dynamically preallocated objects. - ACE_DELETE_PREALLOCATED_OBJECT (ACE_SYNCH_RW_MUTEX, ACE_FILECACHE_LOCK) + // Cleanup the dynamically preallocated objects. + ACE_DELETE_PREALLOCATED_OBJECT (ACE_SYNCH_RW_MUTEX, ACE_FILECACHE_LOCK) #if defined (ACE_HAS_THREADS) - ACE_DELETE_PREALLOCATED_OBJECT (ACE_Recursive_Thread_Mutex, - ACE_STATIC_OBJECT_LOCK) + ACE_DELETE_PREALLOCATED_OBJECT (ACE_Recursive_Thread_Mutex, + ACE_STATIC_OBJECT_LOCK) #endif /* ACE_HAS_THREADS */ # if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) ACE_DELETE_PREALLOCATED_OBJECT (ACE_Thread_Mutex, @@ -345,7 +293,6 @@ ACE_Object_Manager::fini (void) ACE_DELETE_PREALLOCATED_OBJECT (ACE_Thread_Mutex, ACE_MT_CORBA_HANDLER_LOCK) ACE_DELETE_PREALLOCATED_OBJECT (ACE_Thread_Mutex, ACE_DUMP_LOCK) - ACE_DELETE_PREALLOCATED_OBJECT (ACE_Thread_Mutex, ACE_OS_MONITOR_LOCK) ACE_DELETE_PREALLOCATED_OBJECT (ACE_Recursive_Thread_Mutex, ACE_SIG_HANDLER_LOCK) ACE_DELETE_PREALLOCATED_OBJECT (ACE_Null_Mutex, ACE_SINGLETON_NULL_LOCK) @@ -356,13 +303,6 @@ ACE_Object_Manager::fini (void) ACE_TOKEN_MANAGER_CREATION_LOCK) ACE_DELETE_PREALLOCATED_OBJECT (ACE_TOKEN_CONST::MUTEX, ACE_TOKEN_INVARIANTS_CREATION_LOCK) - ACE_DELETE_PREALLOCATED_OBJECT (ACE_Recursive_Thread_Mutex, - ACE_TSS_CLEANUP_LOCK) -# if defined (ACE_HAS_TSS_EMULATION) && \ - defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) - ACE_DELETE_PREALLOCATED_OBJECT (ACE_Recursive_Thread_Mutex, - ACE_TSS_BASE_LOCK) -# endif /* ACE_HAS_TSS_EMULATION && ACE_HAS_THREAD_SPECIFIC_STORAGE */ # endif /* ACE_MT_SAFE */ #endif /* ! ACE_HAS_STATIC_PREALLOCATION */ @@ -370,33 +310,48 @@ ACE_Object_Manager::fini (void) ACE_Static_Object_Lock::cleanup_lock (); #endif /* ACE_HAS_THREADS */ - delete ACE_Object_Manager_instance_->default_mask_; - ACE_Object_Manager_instance_->default_mask_ = 0; + delete default_mask_; + default_mask_ = 0; #if defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER) - if (ACE_Object_Manager_instance_->dynamically_allocated_) + if (dynamically_allocated_) { - delete ACE_Object_Manager_instance_; - ACE_Object_Manager_instance_ = 0; + delete instance_; + instance_ = 0; } #endif /* ACE_HAS_NONSTATIC_OBJECT_MANAGER */ + // Indicate that the ACE_Object_Manager instance has been shut down. + object_manager_state_ = SHUT_DOWN_ACE_OBJ_MAN; + + // Then, ensure that the ACE_OS_Object_Manager gets shut down. + if (ACE_OS_Object_Manager::instance_) + ACE_OS_Object_Manager::instance ()->fini (); + return 0; } ACE_Object_Manager::ACE_Object_Manager (void) // With ACE_HAS_TSS_EMULATION, ts_storage_ is initialized by the call to // ACE_OS::tss_open () in the function body. - : dynamically_allocated_ (0) + : registered_objects_ (0) , preallocations_ (0) , default_mask_ (0) , ace_service_config_sig_handler_ (0) +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + , internal_lock_ (new ACE_Recursive_Thread_Mutex) + , singleton_null_lock_ (0) + , singleton_thread_locks_ (0) + , singleton_mutex_locks_ (0) + , singleton_recursive_lock_ (0) + , singleton_rw_locks_ (0) +# endif /* ACE_MT_SAFE */ { - if (ACE_Object_Manager_instance_ == 0) + if (instance_ == 0) { // Store the address of the instance so that instance () doesn't // allocate a new one when called. - ACE_Object_Manager_instance_ = this; + instance_ = this; // Construct the ACE_Service_Config's signal handler. ACE_NEW (ace_service_config_sig_handler_, @@ -405,10 +360,9 @@ ACE_Object_Manager::ACE_Object_Manager (void) init (); } - // else if ACE_Object_Manager_instance_ was not 0, then then another - // ACE_Object_Manager has already been instantiated. - // Don't do anything, so that it will own all - // ACE_Object_Manager resources. + // else if instance_ was not 0, then then another + // ACE_Object_Manager has already been instantiated. Don't do + // anything, so that it will own all ACE_Object_Manager resources. } ACE_Object_Manager * @@ -418,12 +372,12 @@ ACE_Object_Manager::instance (void) // instances, or before any other threads have been created in // the process. So, it's not thread safe. - if (ACE_Object_Manager_instance_ == 0) + if (instance_ == 0) { ACE_Object_Manager *instance_pointer; ACE_NEW_RETURN (instance_pointer, ACE_Object_Manager, 0); - ACE_ASSERT (instance_pointer == ACE_Object_Manager_instance_); + ACE_ASSERT (instance_pointer == instance_); #if defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER) instance_pointer->dynamically_allocated_ = 1; @@ -433,22 +387,10 @@ ACE_Object_Manager::instance (void) } else { - return ACE_Object_Manager_instance_; + return instance_; } } -int -ACE_Object_Manager::starting_up () -{ - return starting_up_; -} - -int -ACE_Object_Manager::shutting_down () -{ - return shutting_down_; -} - ACE_Sig_Set & ACE_Object_Manager::default_mask (void) { @@ -461,7 +403,7 @@ ACE_Object_Manager::at_exit_i (void *object, void *param) { ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, - *ACE_Object_Manager_instance_->internal_lock_, -1)); + *instance_->internal_lock_, -1)); if (shutting_down ()) { @@ -497,10 +439,9 @@ ACE_Object_Manager::at_exit_i (void *object, #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) int -ACE_Object_Manager_Base::get_singleton_lock (ACE_Null_Mutex *&lock) +ACE_Object_Manager::get_singleton_lock (ACE_Null_Mutex *&lock) { - if (ACE_Object_Manager::starting_up () || - ACE_Object_Manager::shutting_down ()) + if (starting_up () || shutting_down ()) { // The preallocated lock has not been constructed yet. // Therefore, the program is single-threaded at this point. Or, @@ -533,12 +474,11 @@ ACE_Object_Manager_Base::get_singleton_lock (ACE_Null_Mutex *&lock) } int -ACE_Object_Manager_Base::get_singleton_lock (ACE_Thread_Mutex *&lock) +ACE_Object_Manager::get_singleton_lock (ACE_Thread_Mutex *&lock) { if (lock == 0) { - if (ACE_Object_Manager::starting_up () || - ACE_Object_Manager::shutting_down ()) + if (starting_up () || shutting_down ()) { // The Object_Manager and its internal lock have not been // constructed yet. Therefore, the program is single- @@ -622,12 +562,11 @@ ACE_Object_Manager_Base::get_singleton_lock (ACE_Thread_Mutex *&lock) } int -ACE_Object_Manager_Base::get_singleton_lock (ACE_Mutex *&lock) +ACE_Object_Manager::get_singleton_lock (ACE_Mutex *&lock) { if (lock == 0) { - if (ACE_Object_Manager::starting_up () || - ACE_Object_Manager::shutting_down ()) + if (starting_up () || shutting_down ()) { // The Object_Manager and its internal lock have not been // constructed yet. Therefore, the program is single- @@ -711,10 +650,9 @@ ACE_Object_Manager_Base::get_singleton_lock (ACE_Mutex *&lock) } int -ACE_Object_Manager_Base::get_singleton_lock (ACE_Recursive_Thread_Mutex *&lock) +ACE_Object_Manager::get_singleton_lock (ACE_Recursive_Thread_Mutex *&lock) { - if (ACE_Object_Manager::starting_up () || - ACE_Object_Manager::shutting_down ()) + if (starting_up () || shutting_down ()) { // The preallocated lock has not been constructed yet. // Therefore, the program is single-threaded at this point. Or, @@ -746,12 +684,11 @@ ACE_Object_Manager_Base::get_singleton_lock (ACE_Recursive_Thread_Mutex *&lock) } int -ACE_Object_Manager_Base::get_singleton_lock (ACE_RW_Thread_Mutex *&lock) +ACE_Object_Manager::get_singleton_lock (ACE_RW_Thread_Mutex *&lock) { if (lock == 0) { - if (ACE_Object_Manager::starting_up () || - ACE_Object_Manager::shutting_down ()) + if (starting_up () || shutting_down ()) { // The Object_Manager and its internal lock have not been // constructed yet. Therefore, the program is single- @@ -839,43 +776,35 @@ ACE_Object_Manager_Base::get_singleton_lock (ACE_RW_Thread_Mutex *&lock) // NOTE: this function needs to appear _after_ the // get_singleton_lock () functions in order to compile with // g++ 2.7.2.3. -ACE_Object_Manager_Base::~ACE_Object_Manager_Base (void) +ACE_Object_Manager::~ACE_Object_Manager (void) { -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - delete internal_lock_; - internal_lock_ = 0; - - delete singleton_null_lock_; - singleton_null_lock_ = 0; + if (fini () != -1) + { + delete ace_service_config_sig_handler_; + ace_service_config_sig_handler_ = 0; - delete singleton_thread_locks_; - singleton_thread_locks_ = 0; + delete registered_objects_; + registered_objects_ = 0; - delete singleton_mutex_locks_; - singleton_mutex_locks_ = 0; +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + delete internal_lock_; + internal_lock_ = 0; - delete singleton_recursive_lock_; - singleton_recursive_lock_ = 0; + delete singleton_null_lock_; + singleton_null_lock_ = 0; - delete singleton_rw_locks_; - singleton_rw_locks_ = 0; -#endif /* ACE_MT_SAFE */ + delete singleton_thread_locks_; + singleton_thread_locks_ = 0; - delete registered_objects_; - registered_objects_ = 0; -} + delete singleton_mutex_locks_; + singleton_mutex_locks_ = 0; -ACE_Object_Manager::~ACE_Object_Manager (void) -{ -#if defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER) - // Clear the flag so that fini () doesn't delete again. - dynamically_allocated_ = 0; -#endif /* ACE_HAS_NONSTATIC_OBJECT_MANAGER */ + delete singleton_recursive_lock_; + singleton_recursive_lock_ = 0; - if (fini () != -1) - { - delete ace_service_config_sig_handler_; - ace_service_config_sig_handler_ = 0; + delete singleton_rw_locks_; + singleton_rw_locks_ = 0; +#endif /* ACE_MT_SAFE */ } // else fini () had already been called. It would be safe // to delete the 0 pointers again, but this allows us to @@ -883,11 +812,10 @@ ACE_Object_Manager::~ACE_Object_Manager (void) } #if !defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER) -class ACE_Export ACE_Object_Manager_Destroyer +class ACE_Export ACE_Object_Manager_Manager // = TITLE - // Ensure that the <ACE_Object_Manager> gets initialized before any - // application threads have been spawned, and destroyed at program - // termination. + // Ensure that the <ACE_Object_Manager> gets initialized at + // program startup, and destroyed at program termination. // // = DESCRIPTION // Without ACE_HAS_NONSTATIC_OBJECT_MANAGER, a static instance of this @@ -895,15 +823,15 @@ class ACE_Export ACE_Object_Manager_Destroyer // is called. And it gets destroyed after main () returns. { public: - ACE_Object_Manager_Destroyer (void); - ~ACE_Object_Manager_Destroyer (void); + ACE_Object_Manager_Manager (void); + ~ACE_Object_Manager_Manager (void); private: ACE_thread_t saved_main_thread_id_; // Save the main thread ID, so that destruction can be suppressed. }; -ACE_Object_Manager_Destroyer::ACE_Object_Manager_Destroyer (void) +ACE_Object_Manager_Manager::ACE_Object_Manager_Manager (void) : saved_main_thread_id_ (ACE_OS::thr_self ()) { // Ensure that the Object_Manager gets initialized before any @@ -913,20 +841,20 @@ ACE_Object_Manager_Destroyer::ACE_Object_Manager_Destroyer (void) (void) ACE_Object_Manager::instance (); } -ACE_Object_Manager_Destroyer::~ACE_Object_Manager_Destroyer (void) +ACE_Object_Manager_Manager::~ACE_Object_Manager_Manager (void) { if (ACE_OS::thr_equal (ACE_OS::thr_self (), saved_main_thread_id_)) { - delete ACE_Object_Manager_instance_; - ACE_Object_Manager_instance_ = 0; + delete ACE_Object_Manager::instance_; + ACE_Object_Manager::instance_ = 0; } // else if this destructor is not called by the main thread, then do // not delete the ACE_Object_Manager. That causes problems, on // WIN32 at least. } -static ACE_Object_Manager_Destroyer ACE_Object_Manager_Destroyer_internal; +static ACE_Object_Manager_Manager ACE_Object_Manager_Manager_instance; #endif /* ! ACE_HAS_NONSTATIC_OBJECT_MANAGER */ #if defined (ACE_HAS_THREADS) @@ -939,8 +867,8 @@ ACE_Static_Object_Lock_lock = 0; ACE_Recursive_Thread_Mutex * ACE_Static_Object_Lock::instance (void) { - if (ACE_Object_Manager::starting_up () || - ACE_Object_Manager::shutting_down ()) + if (ACE_Object_Manager_Base::starting_up () || \ + ACE_Object_Manager_Base::shutting_down ()) { // The preallocated ACE_STATIC_OBJECT_LOCK has not been // constructed yet. Therefore, the program is single-threaded |