summaryrefslogtreecommitdiff
path: root/ace/Singleton.cpp
diff options
context:
space:
mode:
authornanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-06-02 06:23:09 +0000
committernanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-06-02 06:23:09 +0000
commit5c343e466e3107edbddffb92e7a5f74559754b6c (patch)
tree689409ae3a062b8f19f3ba02838278726003559a /ace/Singleton.cpp
parente89f1c4750067e3ad0844c3d5e9a198731dbe2b7 (diff)
downloadATCD-5c343e466e3107edbddffb92e7a5f74559754b6c.tar.gz
Reverted MP safe Double-checking modification. It doesn't solve the real problem here.
Diffstat (limited to 'ace/Singleton.cpp')
-rw-r--r--ace/Singleton.cpp61
1 files changed, 5 insertions, 56 deletions
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);
}