diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-10-23 02:15:41 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-10-23 02:15:41 +0000 |
commit | 00257bfc0c637400d6d2fac77d4c0421c6c895eb (patch) | |
tree | 4a648f15fe55a3f46a28bfe4b68ee450e2f273ba /ace | |
parent | 6073a0753d2abf908c0090fac64d71b35d10c05a (diff) | |
download | ATCD-00257bfc0c637400d6d2fac77d4c0421c6c895eb.tar.gz |
don't use preallocated lock when shutting_down (), as well as when starting_up ()
Diffstat (limited to 'ace')
-rw-r--r-- | ace/Object_Manager.cpp | 11 | ||||
-rw-r--r-- | ace/Singleton.cpp | 10 |
2 files changed, 15 insertions, 6 deletions
diff --git a/ace/Object_Manager.cpp b/ace/Object_Manager.cpp index 32a396de702..e3b70867812 100644 --- a/ace/Object_Manager.cpp +++ b/ace/Object_Manager.cpp @@ -361,12 +361,15 @@ static ACE_Object_Manager_Destroyer ACE_Object_Manager_Destroyer_internal; ACE_Recursive_Thread_Mutex * ACE_Static_Object_Lock::instance (void) { - if (ACE_Object_Manager::starting_up ()) + if (ACE_Object_Manager::starting_up () || + ACE_Object_Manager::shutting_down ()) { // The preallocated ACE_STATIC_OBJECT_LOCK has not been - // constructed yet. The program is single-threaded at this - // point. Allocate a lock to use, for interface compatibility, - // though there should be no contention on it. + // constructed yet. Therefore, the program is single-threaded + // at this point. Or, the ACE_Object_Manager instance has been + // destroyed, so the preallocated lock is not available. + // Allocate a lock to use, for interface compatibility, though + // there should be no contention on it. static ACE_Cleanup_Adapter<ACE_Recursive_Thread_Mutex> *lock = 0; if (lock == 0) diff --git a/ace/Singleton.cpp b/ace/Singleton.cpp index 62a712d9388..7418a316ef6 100644 --- a/ace/Singleton.cpp +++ b/ace/Singleton.cpp @@ -51,10 +51,13 @@ ACE_Singleton<TYPE, ACE_LOCK>::instance (void) if (singleton == 0) { #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - if (ACE_Object_Manager::starting_up ()) + if (ACE_Object_Manager::starting_up () || + ACE_Object_Manager::shutting_down ()) { // The program is still starting up, and therefore assumed // to be single threaded. There's no need to double-check. + // 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); @@ -133,10 +136,13 @@ ACE_TSS_Singleton<TYPE, ACE_LOCK>::instance (void) if (singleton == 0) { #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - if (ACE_Object_Manager::starting_up ()) + if (ACE_Object_Manager::starting_up () || + ACE_Object_Manager::shutting_down ()) { // The program is still starting up, and therefore assumed // to be single threaded. There's no need to double-check. + // 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_TSS_Singleton<TYPE, ACE_LOCK>), 0); |