diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-10-24 17:49:22 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-10-24 17:49:22 +0000 |
commit | dadd518de64c32dfea80eab972ed53df119fdb5b (patch) | |
tree | 220b441de387fa088e466e104590233458bf71a7 /ace/Singleton.cpp | |
parent | 23184fa3f1ad1d46c2cf125236a76e6cc48728ea (diff) | |
download | ATCD-dadd518de64c32dfea80eab972ed53df119fdb5b.tar.gz |
(get_singleton_lock): dynamically allocate ACE_Thread_Mutex and ACE_RW_Thread_Mutex locks, so we end up with one lock per ACE_Singleton instantiation.
Diffstat (limited to 'ace/Singleton.cpp')
-rw-r--r-- | ace/Singleton.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/ace/Singleton.cpp b/ace/Singleton.cpp index 28b9d23a5de..58e3e56a29b 100644 --- a/ace/Singleton.cpp +++ b/ace/Singleton.cpp @@ -67,12 +67,12 @@ ACE_Singleton<TYPE, ACE_LOCK>::instance (void) } else { - // Use the Object_Manager's preallocated lock. - ACE_LOCK *lock = - ACE_Object_Manager::get_singleton_lock ((ACE_LOCK *) 0); -#if 0 // ???? HACK! Don't guard until singleton lock issue is resolved! + static ACE_LOCK *lock = 0; + // Obtain the lock from the ACE_Object_Manager. + ACE_Object_Manager::get_singleton_lock (lock); + if (lock == 0) return 0; // Failed to allocate the lock! + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, *lock, 0); -#endif // 0 if (singleton == 0) { @@ -157,12 +157,12 @@ ACE_TSS_Singleton<TYPE, ACE_LOCK>::instance (void) } else { - // Use the Object_Manager's preallocated lock. - ACE_LOCK *lock = - ACE_Object_Manager::get_singleton_lock ((ACE_LOCK *) 0); -#if 0 // ???? HACK! Don't guard until singleton lock issue is resolved! + static ACE_LOCK *lock = 0; + // Obtain the lock from the ACE_Object_Manager. + ACE_Object_Manager::get_singleton_lock (lock); + if (lock == 0) return 0; // Failed to allocate the lock. + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, *lock, 0); -#endif // 0 if (singleton == 0) { |