summaryrefslogtreecommitdiff
path: root/TAO/tao/TAO_Singleton.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/tao/TAO_Singleton.cpp')
-rw-r--r--TAO/tao/TAO_Singleton.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/TAO/tao/TAO_Singleton.cpp b/TAO/tao/TAO_Singleton.cpp
index f41683c33e7..bec55534780 100644
--- a/TAO/tao/TAO_Singleton.cpp
+++ b/TAO/tao/TAO_Singleton.cpp
@@ -20,7 +20,9 @@
#include "tao/TAO_Singleton.inl"
#endif /* __ACE_INLINE__ */
-ACE_RCSID (tao, TAO_Singleton, "$Id$")
+ACE_RCSID (tao,
+ TAO_Singleton,
+ "$Id$")
template <class TYPE, class ACE_LOCK> void
TAO_Singleton<TYPE, ACE_LOCK>::dump (void)
@@ -59,7 +61,6 @@ TAO_Singleton<TYPE, ACE_LOCK>::instance (void)
// Perform the Double-Check pattern...
if (singleton == 0)
{
-#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
if (TAO_Singleton_Manager::starting_up () ||
TAO_Singleton_Manager::shutting_down ())
{
@@ -69,13 +70,12 @@ TAO_Singleton<TYPE, ACE_LOCK>::instance (void)
// so the preallocated lock is not available. Either way,
// don't register for destruction with the
// TAO_Singleton_Manager: we'll have to leak this instance.
-#endif /* ACE_MT_SAFE */
ACE_NEW_RETURN (singleton, (TAO_Singleton<TYPE, ACE_LOCK>), 0);
-#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
}
else
{
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
// Obtain a lock from the ACE_Object_Manager. The pointer
// is static, so we only obtain one per TAO_Singleton
// instantiation.
@@ -88,13 +88,15 @@ TAO_Singleton<TYPE, ACE_LOCK>::instance (void)
if (singleton == 0)
{
+#endif /* ACE_MT_SAFE */
ACE_NEW_RETURN (singleton, (TAO_Singleton<TYPE, ACE_LOCK>), 0);
// Register for destruction with TAO_Singleton_Manager.
TAO_Singleton_Manager::at_exit (singleton);
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
}
- }
#endif /* ACE_MT_SAFE */
+ }
}
return &singleton->instance_;
@@ -154,7 +156,6 @@ TAO_TSS_Singleton<TYPE, ACE_LOCK>::instance (void)
// Perform the Double-Check pattern...
if (singleton == 0)
{
-#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
if (TAO_Singleton_Manager::starting_up () ||
TAO_Singleton_Manager::shutting_down ())
{
@@ -164,13 +165,12 @@ TAO_TSS_Singleton<TYPE, ACE_LOCK>::instance (void)
// so the preallocated lock is not available. Either way,
// don't register for destruction with the
// TAO_Singleton_Manager: we'll have to leak this instance.
-#endif /* ACE_MT_SAFE */
ACE_NEW_RETURN (singleton, (TAO_TSS_Singleton<TYPE, ACE_LOCK>), 0);
-#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
}
else
{
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
// Obtain a lock from the ACE_Object_Manager. The pointer
// is static, so we only obtain one per TAO_Singleton
// instantiation.
@@ -183,14 +183,16 @@ TAO_TSS_Singleton<TYPE, ACE_LOCK>::instance (void)
if (singleton == 0)
{
+#endif /* ACE_MT_SAFE */
ACE_NEW_RETURN (singleton, (TAO_TSS_Singleton<TYPE, ACE_LOCK>),
0);
// Register for destruction with TAO_Singleton_Manager.
TAO_Singleton_Manager::at_exit (singleton);
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
}
- }
#endif /* ACE_MT_SAFE */
+ }
}
return ACE_TSS_GET (&singleton->instance_, TYPE);