summaryrefslogtreecommitdiff
path: root/ace/Singleton.h
diff options
context:
space:
mode:
authornanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-06-01 22:07:53 +0000
committernanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-06-01 22:07:53 +0000
commitf237ccbb8414a63231dbef45df8fb42b48a3b923 (patch)
tree0480fc2a840f47762f1ecff517f99240fbae51e0 /ace/Singleton.h
parent7ea34bd80216c224677ced47de722c0a79be4913 (diff)
downloadATCD-f237ccbb8414a63231dbef45df8fb42b48a3b923.tar.gz
Modified double-checking pattern
Diffstat (limited to 'ace/Singleton.h')
-rw-r--r--ace/Singleton.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/ace/Singleton.h b/ace/Singleton.h
index f8bfa8ef8de..0e9b51cec40 100644
--- a/ace/Singleton.h
+++ b/ace/Singleton.h
@@ -73,10 +73,18 @@ 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>
@@ -119,10 +127,18 @@ 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__)