diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-06-02 06:23:09 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-06-02 06:23:09 +0000 |
commit | 5c343e466e3107edbddffb92e7a5f74559754b6c (patch) | |
tree | 689409ae3a062b8f19f3ba02838278726003559a | |
parent | e89f1c4750067e3ad0844c3d5e9a198731dbe2b7 (diff) | |
download | ATCD-5c343e466e3107edbddffb92e7a5f74559754b6c.tar.gz |
Reverted MP safe Double-checking modification. It doesn't solve the real problem here.
-rw-r--r-- | ace/Dump.cpp | 10 | ||||
-rw-r--r-- | ace/Dump.h | 3 | ||||
-rw-r--r-- | ace/Filecache.cpp | 13 | ||||
-rw-r--r-- | ace/Filecache.h | 5 | ||||
-rw-r--r-- | ace/Malloc.cpp | 9 | ||||
-rw-r--r-- | ace/Malloc.h | 3 | ||||
-rw-r--r-- | ace/Proactor.cpp | 8 | ||||
-rw-r--r-- | ace/Proactor.h | 3 | ||||
-rw-r--r-- | ace/Reactor.cpp | 8 | ||||
-rw-r--r-- | ace/Reactor.h | 3 | ||||
-rw-r--r-- | ace/Service_Repository.cpp | 8 | ||||
-rw-r--r-- | ace/Service_Repository.h | 3 | ||||
-rw-r--r-- | ace/Singleton.cpp | 61 | ||||
-rw-r--r-- | ace/Singleton.h | 16 | ||||
-rw-r--r-- | ace/Thread_Manager.cpp | 12 | ||||
-rw-r--r-- | ace/Thread_Manager.h | 3 |
16 files changed, 22 insertions, 146 deletions
diff --git a/ace/Dump.cpp b/ace/Dump.cpp index 66298ccc454..f414a02f6e2 100644 --- a/ace/Dump.cpp +++ b/ace/Dump.cpp @@ -53,18 +53,15 @@ ACE_ODB::instance (void) { ACE_TRACE ("ACE_ODB::instance"); - if (ACE_ODB::instantiated_ == 0) + if (ACE_ODB::instance_ == 0) { ACE_MT (ACE_Thread_Mutex *lock = ACE_Managed_Object<ACE_Thread_Mutex>::get_preallocated_object (ACE_Object_Manager::ACE_DUMP_LOCK); ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, 0)); - if (ACE_ODB::instantiated_ == 0) - { - ACE_NEW_RETURN (ACE_ODB::instance_, ACE_ODB, 0); - ACE_ODB::instantiated_ = -1; - } + if (ACE_ODB::instance_ == 0) + ACE_NEW_RETURN (ACE_ODB::instance_, ACE_ODB, 0); } return ACE_ODB::instance_; @@ -132,7 +129,6 @@ ACE_ODB::remove_object (const void *this_ptr) } ACE_ODB *ACE_ODB::instance_ = 0; -int ACE_ODB::instantiated_ = 0; #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) ACE_MT (template class ACE_Guard<ACE_Thread_Mutex>); diff --git a/ace/Dump.h b/ace/Dump.h index b50ab5a60ca..dba4b03965d 100644 --- a/ace/Dump.h +++ b/ace/Dump.h @@ -137,9 +137,6 @@ private: static ACE_ODB *instance_; // Singleton instance of this class. - static int instantiated_; - // Flag indicating whether the <instance_> has been instantiated or not. - Tuple object_table_[ACE_ODB::MAX_TABLE_SIZE]; // The current implementation is very simple-minded and will be // changed to be dynamic. diff --git a/ace/Filecache.cpp b/ace/Filecache.cpp index 484c41c03c2..5662fc3a3ea 100644 --- a/ace/Filecache.cpp +++ b/ace/Filecache.cpp @@ -35,7 +35,6 @@ static const int WRITE_FLAGS = O_RDWR | O_CREAT | O_TRUNC; // static data members ACE_Filecache *ACE_Filecache::cvf_ = 0; -int ACE_Filecache::instantiated_ = 0; void ACE_Filecache_Handle::init (void) @@ -187,7 +186,7 @@ ACE_Filecache * ACE_Filecache::instance (void) { // Double check locking pattern. - if (ACE_Filecache::instantiated_ == 0) + if (ACE_Filecache::cvf_ == 0) { ACE_SYNCH_RW_MUTEX &lock = *ACE_Managed_Object<ACE_SYNCH_RW_MUTEX>::get_preallocated_object @@ -196,14 +195,8 @@ ACE_Filecache::instance (void) // @@ James, please check each of the ACE_NEW_RETURN calls to // make sure that it is safe to return if allocation fails. - if (ACE_Filecache::instantiated_ == 0) - { - ACE_NEW_RETURN (ACE_Filecache::cvf_, ACE_Filecache, 0); - ACE_Filecache::instantiated_ = -1; - // @@ There's no cleanup routine for ACE_Filecache singleton - // at this moment. Don't forget to reset <instantiated_> to - // 0 after destructing it. - } + if (ACE_Filecache::cvf_ == 0) + ACE_NEW_RETURN (ACE_Filecache::cvf_, ACE_Filecache, 0); } return ACE_Filecache::cvf_; diff --git a/ace/Filecache.h b/ace/Filecache.h index 1495c5dac27..468b5254157 100644 --- a/ace/Filecache.h +++ b/ace/Filecache.h @@ -225,10 +225,7 @@ private: static ACE_Filecache *cvf_; // The reference to the instance - static int instantiated_; - // Flag indicating whether <cvf_> has been instantiated or not. - - // = Synchronization variables. + // = Synchronization variables. ACE_SYNCH_RW_MUTEX hash_lock_[DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE]; ACE_SYNCH_RW_MUTEX file_lock_[DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE]; }; diff --git a/ace/Malloc.cpp b/ace/Malloc.cpp index 475bd32fb7e..cd85f0a9061 100644 --- a/ace/Malloc.cpp +++ b/ace/Malloc.cpp @@ -15,7 +15,6 @@ // Process-wide ACE_Allocator. ACE_Allocator *ACE_Allocator::allocator_ = 0; -int ACE_Allocator::instantiated_ = 0; // Controls whether the Allocator is deleted when we shut down (we can // only delete it safely if we created it!) This is no longer used; @@ -67,13 +66,13 @@ ACE_Allocator::instance (void) { // ACE_TRACE ("ACE_Allocator::instance"); - if (ACE_Allocator::instantiated_ == 0) + if (ACE_Allocator::allocator_ == 0) { // Perform Double-Checked Locking Optimization. ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, *ACE_Static_Object_Lock::instance (), 0)); - if (ACE_Allocator::instantiated_ == 0) + if (ACE_Allocator::allocator_ == 0) { // Have a seat. We want to avoid ever having to delete the // ACE_Allocator instance, to avoid shutdown order @@ -107,8 +106,6 @@ ACE_Allocator::instance (void) // ACE_Allocator::allocator_ = // (ACE_New_Allocator *) // new (&allocator_instance) ACE_New_Allocator; - - ACE_Allocator::instantiated_ = -1; } } @@ -127,7 +124,6 @@ ACE_Allocator::instance (ACE_Allocator *r) ACE_Allocator::delete_allocator_ = 0; ACE_Allocator::allocator_ = r; - ACE_Allocator::instantiated_ = (r != 0 ? -1 : 0); return t; } @@ -144,7 +140,6 @@ ACE_Allocator::close_singleton (void) // This should never be executed. See ACE_Allocator::instance (void). delete ACE_Allocator::allocator_; ACE_Allocator::allocator_ = 0; - ACE_Allocator::instantiated_ = 0; ACE_Allocator::delete_allocator_ = 0; } } diff --git a/ace/Malloc.h b/ace/Malloc.h index 4df8997c60c..1eb0aceb485 100644 --- a/ace/Malloc.h +++ b/ace/Malloc.h @@ -124,9 +124,6 @@ private: static ACE_Allocator *allocator_; // Pointer to a process-wide <ACE_Allocator> instance. - static int instantiated_; - // Flag indicating whether the singleton <allocator_> has been instantiated or not. - static int delete_allocator_; // Must delete the <allocator_> if non-0. }; diff --git a/ace/Proactor.cpp b/ace/Proactor.cpp index 7fc8d497223..ae41e67d811 100644 --- a/ace/Proactor.cpp +++ b/ace/Proactor.cpp @@ -17,7 +17,6 @@ // Process-wide ACE_Proactor. ACE_Proactor *ACE_Proactor::proactor_ = 0; -int ACE_Proactor::instantiated_ = 0; // Controls whether the Proactor is deleted when we shut down (we can // only delete it safely if we created it!) @@ -238,16 +237,15 @@ ACE_Proactor::instance (size_t threads) { ACE_TRACE ("ACE_Proactor::instance"); - if (ACE_Proactor::instantiated_ == 0) + if (ACE_Proactor::proactor_ == 0) { // Perform Double-Checked Locking Optimization. ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, *ACE_Static_Object_Lock::instance (), 0)); - if (ACE_Proactor::instantiated_ == 0) + if (ACE_Proactor::proactor_ == 0) { ACE_NEW_RETURN (ACE_Proactor::proactor_, ACE_Proactor (threads), 0); - ACE_Proactor::instantiated_ = -1; ACE_Proactor::delete_proactor_ = 1; } } @@ -267,7 +265,6 @@ ACE_Proactor::instance (ACE_Proactor *r) ACE_Proactor::delete_proactor_ = 0; ACE_Proactor::proactor_ = r; - ACE_Proactor::instantiated_ = (r != 0 ? -1 : 0); return t; } @@ -282,7 +279,6 @@ ACE_Proactor::close_singleton (void) if (ACE_Proactor::delete_proactor_) { delete ACE_Proactor::proactor_; - ACE_Proactor::instantiated_ = 0; ACE_Proactor::proactor_ = 0; ACE_Proactor::delete_proactor_ = 0; } diff --git a/ace/Proactor.h b/ace/Proactor.h index c4a85dc194a..f672335f37f 100644 --- a/ace/Proactor.h +++ b/ace/Proactor.h @@ -324,9 +324,6 @@ private: static ACE_Proactor *proactor_; // Pointer to a process-wide <ACE_Proactor>. - static int instantiated_; - // Flags indicating whether <proactor_> has been instantiated or not. - static int delete_proactor_; // Must delete the <proactor_> if non-0. diff --git a/ace/Reactor.cpp b/ace/Reactor.cpp index 23bab610de0..4c97be43438 100644 --- a/ace/Reactor.cpp +++ b/ace/Reactor.cpp @@ -48,7 +48,6 @@ ACE_Reactor::~ACE_Reactor (void) // Process-wide ACE_Reactor. ACE_Reactor *ACE_Reactor::reactor_ = 0; -int ACE_Reactor::instantiated_ = 0; // Controls whether the Reactor is deleted when we shut down (we can // only delete it safely if we created it!) @@ -62,17 +61,16 @@ ACE_Reactor::instance (void) { ACE_TRACE ("ACE_Reactor::instance"); - if (ACE_Reactor::instantiated_ == 0) + if (ACE_Reactor::reactor_ == 0) { // Perform Double-Checked Locking Optimization. ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, *ACE_Static_Object_Lock::instance (), 0)); - if (ACE_Reactor::instantiated_ == 0) + if (ACE_Reactor::reactor_ == 0) { ACE_NEW_RETURN (ACE_Reactor::reactor_, ACE_Reactor, 0); ACE_Reactor::delete_reactor_ = 1; - ACE_Reactor::instantiated_ = -1; } } return ACE_Reactor::reactor_; @@ -90,7 +88,6 @@ ACE_Reactor::instance (ACE_Reactor *r) ACE_Reactor::delete_reactor_ = 0; ACE_Reactor::reactor_ = r; - ACE_Reactor::instantiated_ = (r != 0 ? -1 : 0); return t; } @@ -107,7 +104,6 @@ ACE_Reactor::close_singleton (void) delete ACE_Reactor::reactor_; ACE_Reactor::reactor_ = 0; ACE_Reactor::delete_reactor_ = 0; - ACE_Reactor::instantiated_ = 0; } } diff --git a/ace/Reactor.h b/ace/Reactor.h index 59a52fecfa2..6f2aaf982e5 100644 --- a/ace/Reactor.h +++ b/ace/Reactor.h @@ -445,9 +445,6 @@ protected: static ACE_Reactor *reactor_; // Pointer to a process-wide <ACE_Reactor> singleton. - static int instantiated_; - // Flag indicating whether the singleton reactor has been instantiated or not. - static int delete_reactor_; // Must delete the <reactor_> singleton if non-0. diff --git a/ace/Service_Repository.cpp b/ace/Service_Repository.cpp index 7556eb24685..fd5eb704575 100644 --- a/ace/Service_Repository.cpp +++ b/ace/Service_Repository.cpp @@ -13,7 +13,6 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Service_Repository) // Process-wide Service Repository. ACE_Service_Repository *ACE_Service_Repository::svc_rep_ = 0; -int ACE_Service_Repository::instantiated_ = 0; // Controls whether the Service_Repository is deleted when we shut // down (we can only delete it safely if we created it!) @@ -38,17 +37,16 @@ ACE_Service_Repository::instance (int size /* = ACE_Service_Repository::DEFAULT_ { ACE_TRACE ("ACE_Service_Config::instance"); - if (ACE_Service_Repository::instantiated_ == 0) + if (ACE_Service_Repository::svc_rep_ == 0) { // Perform Double-Checked Locking Optimization. ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, *ACE_Static_Object_Lock::instance (), 0)); - if (ACE_Service_Repository::instantiated_ == 0) + if (ACE_Service_Repository::svc_rep_ == 0) { ACE_NEW_RETURN (ACE_Service_Repository::svc_rep_, ACE_Service_Repository (size), 0); ACE_Service_Repository::delete_svc_rep_ = 1; - ACE_Service_Repository::instantiated_ = -1; } } return ACE_Service_Repository::svc_rep_; @@ -66,7 +64,6 @@ ACE_Service_Repository::instance (ACE_Service_Repository *s) ACE_Service_Repository::delete_svc_rep_ = 0; ACE_Service_Repository::svc_rep_ = s; - ACE_Service_Repository::instantiated_ = (s != 0 ? -1 : 0); return t; } @@ -83,7 +80,6 @@ ACE_Service_Repository::close_singleton (void) delete ACE_Service_Repository::svc_rep_; ACE_Service_Repository::svc_rep_ = 0; ACE_Service_Repository::delete_svc_rep_ = 0; - ACE_Service_Repository::instantiated_ = 0; } } diff --git a/ace/Service_Repository.h b/ace/Service_Repository.h index 4ff2668013e..c620e0ddfe2 100644 --- a/ace/Service_Repository.h +++ b/ace/Service_Repository.h @@ -115,9 +115,6 @@ private: static ACE_Service_Repository *svc_rep_; // Pointer to a process-wide <ACE_Service_Repository>. - static int instantiated_; - // Flag indicating whether the singleton has been instantiated or not. - static int delete_svc_rep_; // Must delete the <svc_rep_> if non-0. diff --git a/ace/Singleton.cpp b/ace/Singleton.cpp index 90d54bd88f9..1a59137ed36 100644 --- a/ace/Singleton.cpp +++ b/ace/Singleton.cpp @@ -38,20 +38,6 @@ ACE_Singleton<TYPE, ACE_LOCK>::instance_i (void) #endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */ } -template <class TYPE, class ACE_LOCK> int & -ACE_Singleton<TYPE, ACE_LOCK>::completion_flag (void) -{ -#if defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) - // Pointer to the completion flag. This works around a bug with - // G++ and it's (mis-)handling of templates and statics... - static int completion_flag_ = 0; - - return completion_flag_; -#else - return ACE_Singleton<TYPE, ACE_LOCK>::completion_flag_; -#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */ -} - template <class TYPE, class ACE_LOCK> TYPE * ACE_Singleton<TYPE, ACE_LOCK>::instance (void) { @@ -60,11 +46,8 @@ ACE_Singleton<TYPE, ACE_LOCK>::instance (void) ACE_Singleton<TYPE, ACE_LOCK> *&singleton = ACE_Singleton<TYPE, ACE_LOCK>::instance_i (); - int &completion = - ACE_Singleton<TYPE, ACE_LOCK>::completion_flag (); - // Perform the Double-Check pattern... - if (completion == 0) + if (singleton == 0) { #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) if (ACE_Object_Manager::starting_up () || @@ -75,10 +58,7 @@ ACE_Singleton<TYPE, ACE_LOCK>::instance (void) // Or, the ACE_Object_Manager instance has been destroyed, // so the preallocated lock is not available. #endif /* ACE_MT_SAFE */ - ACE_NEW_RETURN (singleton, - (ACE_Singleton<TYPE, ACE_LOCK>), 0); - completion = -1; - // Mark the completion status. + ACE_NEW_RETURN (singleton, (ACE_Singleton<TYPE, ACE_LOCK>), 0); // Register for destruction with ACE_Object_Manager. ACE_Object_Manager::at_exit (singleton); @@ -95,13 +75,10 @@ ACE_Singleton<TYPE, ACE_LOCK>::instance (void) ACE_GUARD_RETURN (ACE_LOCK, ace_mon, *lock, 0); - if (completion == 0) + if (singleton == 0) { ACE_NEW_RETURN (singleton, (ACE_Singleton<TYPE, ACE_LOCK>), 0); - - completion = -1; - // Mark the completion status. // Register for destruction with ACE_Object_Manager. ACE_Object_Manager::at_exit (singleton); @@ -117,7 +94,6 @@ template <class TYPE, class ACE_LOCK> void ACE_Singleton<TYPE, ACE_LOCK>::cleanup (void *) { delete this; - ACE_Singleton<TYPE, ACE_LOCK>::completion_flag () = 0; ACE_Singleton<TYPE, ACE_LOCK>::instance_i () = 0; } @@ -125,10 +101,6 @@ ACE_Singleton<TYPE, ACE_LOCK>::cleanup (void *) // Pointer to the Singleton instance. template <class TYPE, class ACE_LOCK> ACE_Singleton<TYPE, ACE_LOCK> * ACE_Singleton<TYPE, ACE_LOCK>::singleton_ = 0; - -// Completion status. -template <class TYPE, class ACE_LOCK> int -ACE_Singleton<TYPE, ACE_LOCK>::completion_flag_ = 0; #endif /* !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) */ template <class TYPE, class ACE_LOCK> void @@ -157,20 +129,6 @@ ACE_TSS_Singleton<TYPE, ACE_LOCK>::instance_i (void) #endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */ } -template <class TYPE, class ACE_LOCK> int & -ACE_TSS_Singleton<TYPE, ACE_LOCK>::completion_flag (void) -{ -#if defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) - // Pointer to the completion flag. This works around a bug with - // G++ and it's (mis-)handling of templates and statics... - static int completion_flag_ = 0; - - return completion_flag_; -#else - return ACE_TSS_Singleton<TYPE, ACE_LOCK>::completion_flag_; -#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */ -} - template <class TYPE, class ACE_LOCK> TYPE * ACE_TSS_Singleton<TYPE, ACE_LOCK>::instance (void) { @@ -179,11 +137,8 @@ ACE_TSS_Singleton<TYPE, ACE_LOCK>::instance (void) ACE_TSS_Singleton<TYPE, ACE_LOCK> *&singleton = ACE_TSS_Singleton<TYPE, ACE_LOCK>::instance_i (); - int &completion = - ACE_TSS_Singleton<TYPE, ACE_LOCK>::completion_flag (); - // Perform the Double-Check pattern... - if (completion == 0) + if (singleton == 0) { #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) if (ACE_Object_Manager::starting_up () || @@ -196,9 +151,6 @@ ACE_TSS_Singleton<TYPE, ACE_LOCK>::instance (void) #endif /* ACE_MT_SAFE */ ACE_NEW_RETURN (singleton, (ACE_TSS_Singleton<TYPE, ACE_LOCK>), 0); - completion = -1; - // Mark completion status. - // Register for destruction with ACE_Object_Manager. ACE_Object_Manager::at_exit (singleton); #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) @@ -214,14 +166,11 @@ ACE_TSS_Singleton<TYPE, ACE_LOCK>::instance (void) ACE_GUARD_RETURN (ACE_LOCK, ace_mon, *lock, 0); - if (completion == 0) + if (singleton == 0) { ACE_NEW_RETURN (singleton, (ACE_TSS_Singleton<TYPE, ACE_LOCK>), 0); - completion = -1; - // Mark completion status. - // Register for destruction with ACE_Object_Manager. ACE_Object_Manager::at_exit (singleton); } diff --git a/ace/Singleton.h b/ace/Singleton.h index 0e9b51cec40..f8bfa8ef8de 100644 --- a/ace/Singleton.h +++ b/ace/Singleton.h @@ -73,18 +73,10 @@ protected: #if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) static ACE_Singleton<TYPE, ACE_LOCK> *singleton_; // Pointer to the Singleton (ACE_Cleanup) instance. - - static int completion_flag_; - // A flag indicating the complete instantiation (and writing) of - // <singleton_>. By checking this flag instead of <singleton_> - // directly, we avoid the problem of Singleton not being MP safe. #endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */ static ACE_Singleton<TYPE, ACE_LOCK> *&instance_i (void); // Get pointer to the Singleton instance. - - static int &completion_flag (void); - // Access the singleton completion status. }; template <class TYPE, class ACE_LOCK> @@ -127,18 +119,10 @@ protected: #if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) static ACE_TSS_Singleton<TYPE, ACE_LOCK> *singleton_; // Pointer to the Singleton (ACE_Cleanup) instance. - - static int completion_flag_; - // A flag indicating the complete instantiation (and writing) of - // <singleton_>. By checking this flag instead of <singleton_> - // directly, we avoid the problem of Singleton not being MP safe. #endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */ static ACE_TSS_Singleton<TYPE, ACE_LOCK> *&instance_i (void); // Get pointer to the TSS Singleton instance. - - static int &completion_flag (void); - // Access the singleton completion status. }; #if defined (__ACE_INLINE__) diff --git a/ace/Thread_Manager.cpp b/ace/Thread_Manager.cpp index a52d6132731..e357c037266 100644 --- a/ace/Thread_Manager.cpp +++ b/ace/Thread_Manager.cpp @@ -17,9 +17,6 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Manager) // Process-wide Thread Manager. ACE_Thread_Manager *ACE_Thread_Manager::thr_mgr_ = 0; -// Flag that ensures accessing <thr_mgr_> is an MP safe op. -int ACE_Thread_Manager::instantiated_ = 0; - // Controls whether the Thread_Manager is deleted when we shut down // (we can only delete it safely if we created it!) int ACE_Thread_Manager::delete_thr_mgr_ = 0; @@ -219,17 +216,16 @@ ACE_Thread_Manager::instance (void) { ACE_TRACE ("ACE_Thread_Manager::instance"); - if (ACE_Thread_Manager::instantiated_ == 0) + if (ACE_Thread_Manager::thr_mgr_ == 0) { // Perform Double-Checked Locking Optimization. ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, *ACE_Static_Object_Lock::instance (), 0)); - if (ACE_Thread_Manager::instantiated_ == 0) + if (ACE_Thread_Manager::thr_mgr_ == 0) { ACE_NEW_RETURN (ACE_Thread_Manager::thr_mgr_, ACE_Thread_Manager, 0); ACE_Thread_Manager::delete_thr_mgr_ = 1; - ACE_Thread_Manager::instantiated_ = -1; } } @@ -248,9 +244,6 @@ ACE_Thread_Manager::instance (ACE_Thread_Manager *tm) ACE_Thread_Manager::delete_thr_mgr_ = 0; ACE_Thread_Manager::thr_mgr_ = tm; - - ACE_Thread_Manager::instantiated_ = (tm != 0 ? -1 : 0); - return t; } @@ -267,7 +260,6 @@ ACE_Thread_Manager::close_singleton (void) // First, we clean up the thread descriptor list. ACE_Thread_Manager::thr_mgr_->close (); delete ACE_Thread_Manager::thr_mgr_; - ACE_Thread_Manager::instantiated_= 0; ACE_Thread_Manager::thr_mgr_ = 0; ACE_Thread_Manager::delete_thr_mgr_ = 0; } diff --git a/ace/Thread_Manager.h b/ace/Thread_Manager.h index b2e69d999ff..147d8a9c530 100644 --- a/ace/Thread_Manager.h +++ b/ace/Thread_Manager.h @@ -623,9 +623,6 @@ private: static ACE_Thread_Manager *thr_mgr_; // Pointer to a process-wide <ACE_Thread_Manager>. - static int instantiated_; - // Flag indicating whether the <thr_mgr_> contains a valid ptr or not. - static int delete_thr_mgr_; // Must delete the <thr_mgr_> if non-0. }; |