diff options
author | cleeland <cleeland@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-07-10 21:42:40 +0000 |
---|---|---|
committer | cleeland <cleeland@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-07-10 21:42:40 +0000 |
commit | 3cbf456bf0295aa5edcd1e16a9630085e2fc3611 (patch) | |
tree | 4f665e8c7e764f3117e65fcb69e4e5926adeb328 /TAO/tao/params.cpp | |
parent | 9c011648db35cc96fb050d1fafeda9dde3e7b2ae (diff) | |
download | ATCD-3cbf456bf0295aa5edcd1e16a9630085e2fc3611.tar.gz |
Removed some obsolete files & code, hacked IID_STUB_Object to work on
both NT and non-NT platforms, and made minor corrections on the manual
singleton implementation for TAO_OA_PARAMS.
Diffstat (limited to 'TAO/tao/params.cpp')
-rw-r--r-- | TAO/tao/params.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/TAO/tao/params.cpp b/TAO/tao/params.cpp index acfc15ad309..96ba968ea38 100644 --- a/TAO/tao/params.cpp +++ b/TAO/tao/params.cpp @@ -2,6 +2,48 @@ #include "connect.h" #include "objtable.h" +TAO_OA_Parameters * +TAO_OA_Parameters::instance (void) +{ + ACE_TRACE ("TAO_OA_Parameters::instance"); + + TAO_OA_Parameters *&singleton = TAO_OA_Parameters::instance_i (); + + // Perform the Double-Check pattern... + if (singleton == 0) + { + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, (TAO_OA_Parameters::singleton_lock_i ()), 0); + + if (singleton == 0) + ACE_NEW_RETURN (singleton, TAO_OA_Parameters, 0); + } + + return singleton; +} + +TAO_OA_Parameters * +TAO_OA_Parameters::instance (TAO_OA_Parameters *new_instance) +{ + ACE_TRACE ("TAO_OA_Parameters::set_instance"); + + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, (TAO_OA_Parameters::singleton_lock_i ()), 0); + + TAO_OA_Parameters *&singleton = TAO_OA_Parameters::instance_i (); + TAO_OA_Parameters *old_instance = singleton; + singleton = new_instance; + + return old_instance; +} + + +#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) +// Pointer to the Singleton instance. +TAO_OA_Parameters *TAO_OA_Parameters::instance_ = 0; + +// Lock the creation of the singleton. +ACE_SYNCH_MUTEX TAO_OA_Parameters::ace_singleton_lock_; +#endif /* !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) */ + #if !defined(__ACE_INLINE__) # include "params.i" #endif |