Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Singleton.cpp

Go to the documentation of this file.
00001 // $Id: Singleton.cpp,v 1.1.1.4 2003/02/21 18:36:32 chad Exp $
00002 
00003 #ifndef ACE_SINGLETON_C
00004 #define ACE_SINGLETON_C
00005 
00006 #include "ace/Singleton.h"
00007 
00008 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00009 # pragma once
00010 #endif /* ACE_LACKS_PRAGMA_ONCE */
00011 
00012 #if !defined (__ACE_INLINE__)
00013 #include "ace/Singleton.i"
00014 #endif /* __ACE_INLINE__ */
00015 
00016 #include "ace/Synch_T.h"
00017 #include "ace/Object_Manager.h"
00018 #include "ace/Log_Msg.h"
00019 #include "ace/Framework_Component.h"
00020 
00021 ACE_RCSID (ace,
00022            Singleton,
00023            "$Id: Singleton.cpp,v 1.1.1.4 2003/02/21 18:36:32 chad Exp $")
00024 
00025 template <class TYPE, class ACE_LOCK> void
00026 ACE_Singleton<TYPE, ACE_LOCK>::dump (void)
00027 {
00028   ACE_TRACE ("ACE_Singleton<TYPE, ACE_LOCK>::dump");
00029 
00030 #if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
00031   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("instance_ = %x"),
00032               ACE_Singleton<TYPE, ACE_LOCK>::instance_i ()));
00033   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00034 #endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */
00035 }
00036 
00037 template <class TYPE, class ACE_LOCK> ACE_Singleton<TYPE, ACE_LOCK> *&
00038 ACE_Singleton<TYPE, ACE_LOCK>::instance_i (void)
00039 {
00040 #if defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
00041   // Pointer to the Singleton instance.  This works around a bug with
00042   // G++ and it's (mis-)handling of templates and statics...
00043   static ACE_Singleton<TYPE, ACE_LOCK> *singleton_ = 0;
00044 
00045   return singleton_;
00046 #else
00047   return ACE_Singleton<TYPE, ACE_LOCK>::singleton_;
00048 #endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */
00049 }
00050 
00051 template <class TYPE, class ACE_LOCK> TYPE *
00052 ACE_Singleton<TYPE, ACE_LOCK>::instance (void)
00053 {
00054   ACE_TRACE ("ACE_Singleton<TYPE, ACE_LOCK>::instance");
00055 
00056   ACE_Singleton<TYPE, ACE_LOCK> *&singleton =
00057     ACE_Singleton<TYPE, ACE_LOCK>::instance_i ();
00058 
00059   // Perform the Double-Check pattern...
00060   if (singleton == 0)
00061     {
00062       if (ACE_Object_Manager::starting_up () ||
00063           ACE_Object_Manager::shutting_down ())
00064         {
00065           // The program is still starting up, and therefore assumed
00066           // to be single threaded.  There's no need to double-check.
00067           // Or, the ACE_Object_Manager instance has been destroyed,
00068           // so the preallocated lock is not available.  Either way,
00069           // don't register for destruction with the
00070           // ACE_Object_Manager:  we'll have to leak this instance.
00071 
00072           ACE_NEW_RETURN (singleton, (ACE_Singleton<TYPE, ACE_LOCK>), 0);
00073         }
00074       else
00075         {
00076 #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
00077           // Obtain a lock from the ACE_Object_Manager.  The pointer
00078           // is static, so we only obtain one per ACE_Singleton
00079           // instantiation.
00080           static ACE_LOCK *lock = 0;
00081           if (ACE_Object_Manager::get_singleton_lock (lock) != 0)
00082             // Failed to acquire the lock!
00083             return 0;
00084 
00085           ACE_GUARD_RETURN (ACE_LOCK, ace_mon, *lock, 0);
00086 
00087           if (singleton == 0)
00088             {
00089 #endif /* ACE_MT_SAFE */
00090               ACE_NEW_RETURN (singleton, (ACE_Singleton<TYPE, ACE_LOCK>), 0);
00091 
00092               // Register for destruction with ACE_Object_Manager.
00093               ACE_Object_Manager::at_exit (singleton);
00094 #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
00095             }
00096 #endif /* ACE_MT_SAFE */
00097         }
00098     }
00099 
00100   return &singleton->instance_;
00101 }
00102 
00103 template <class TYPE, class ACE_LOCK> void
00104 ACE_Singleton<TYPE, ACE_LOCK>::cleanup (void *)
00105 {
00106   delete this;
00107   ACE_Singleton<TYPE, ACE_LOCK>::instance_i () = 0;
00108 }
00109 
00110 #if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
00111 // Pointer to the Singleton instance.
00112 template <class TYPE, class ACE_LOCK> ACE_Singleton<TYPE, ACE_LOCK> *
00113 ACE_Singleton<TYPE, ACE_LOCK>::singleton_ = 0;
00114 
00115 template <class TYPE, class ACE_LOCK> ACE_Unmanaged_Singleton<TYPE, ACE_LOCK> *
00116 ACE_Unmanaged_Singleton<TYPE, ACE_LOCK>::singleton_ = 0;
00117 #endif /* !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) */
00118 
00119 template <class TYPE, class ACE_LOCK> void
00120 ACE_Unmanaged_Singleton<TYPE, ACE_LOCK>::dump (void)
00121 {
00122   ACE_TRACE ("ACE_Unmanaged_Singleton<TYPE, ACE_LOCK>::dump");
00123 
00124 #if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
00125   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("instance_ = %x"),
00126               ACE_Unmanaged_Singleton<TYPE, ACE_LOCK>::instance_i ()));
00127   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00128 #endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */
00129 }
00130 
00131 template <class TYPE, class ACE_LOCK>
00132 ACE_Unmanaged_Singleton<TYPE, ACE_LOCK> *&
00133 ACE_Unmanaged_Singleton<TYPE, ACE_LOCK>::instance_i (void)
00134 {
00135 #if defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
00136   // Pointer to the Singleton instance.  This works around a bug with
00137   // G++ and it's (mis-)handling of templates and statics...
00138   static ACE_Unmanaged_Singleton<TYPE, ACE_LOCK> *singleton_ = 0;
00139 
00140   return singleton_;
00141 #else
00142   return ACE_Unmanaged_Singleton<TYPE, ACE_LOCK>::singleton_;
00143 #endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */
00144 }
00145 
00146 template <class TYPE, class ACE_LOCK> TYPE *
00147 ACE_Unmanaged_Singleton<TYPE, ACE_LOCK>::instance (void)
00148 {
00149   ACE_TRACE ("ACE_Unmanaged_Singleton<TYPE, ACE_LOCK>::instance");
00150 
00151   ACE_Unmanaged_Singleton<TYPE, ACE_LOCK> *&singleton =
00152     ACE_Unmanaged_Singleton<TYPE, ACE_LOCK>::instance_i ();
00153 
00154   // Perform the Double-Check pattern...
00155   if (singleton == 0)
00156     {
00157       if (ACE_Object_Manager::starting_up () ||
00158           ACE_Object_Manager::shutting_down ())
00159         {
00160           // The program is still starting up, and therefore assumed
00161           // to be single threaded.  There's no need to double-check.
00162           // Or, the ACE_Object_Manager instance has been destroyed,
00163           // so the preallocated lock is not available.  Either way,
00164           // don't register for destruction with the
00165           // ACE_Object_Manager:  we'll have to leak this instance.
00166 
00167           ACE_NEW_RETURN (singleton, (ACE_Unmanaged_Singleton<TYPE, ACE_LOCK>),
00168                           0);
00169         }
00170       else
00171         {
00172 #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
00173           // Obtain a lock from the ACE_Object_Manager.  The pointer
00174           // is static, so we only obtain one per
00175           // ACE_Unmanaged_Singleton instantiation.
00176           static ACE_LOCK *lock = 0;
00177           if (ACE_Object_Manager::get_singleton_lock (lock) != 0)
00178             // Failed to acquire the lock!
00179             return 0;
00180 
00181           ACE_GUARD_RETURN (ACE_LOCK, ace_mon, *lock, 0);
00182 #endif /* ACE_MT_SAFE */
00183 
00184           if (singleton == 0)
00185             ACE_NEW_RETURN (singleton,
00186                             (ACE_Unmanaged_Singleton<TYPE, ACE_LOCK>),
00187                             0);
00188         }
00189     }
00190 
00191   return &singleton->instance_;
00192 }
00193 
00194 template <class TYPE, class ACE_LOCK> void
00195 ACE_Unmanaged_Singleton<TYPE, ACE_LOCK>::close (void)
00196 {
00197   ACE_Unmanaged_Singleton<TYPE, ACE_LOCK> *&singleton =
00198     ACE_Unmanaged_Singleton<TYPE, ACE_LOCK>::instance_i ();
00199 
00200   if (singleton)
00201     {
00202       singleton->cleanup ();
00203       ACE_Unmanaged_Singleton<TYPE, ACE_LOCK>::instance_i () = 0;
00204     }
00205 }
00206 
00207 template <class TYPE, class ACE_LOCK> void
00208 ACE_TSS_Singleton<TYPE, ACE_LOCK>::dump (void)
00209 {
00210   ACE_TRACE ("ACE_TSS_Singleton<TYPE, ACE_LOCK>::dump");
00211 
00212 #if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
00213   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("instance_ = %x"),
00214               ACE_TSS_Singleton<TYPE, ACE_LOCK>::instance_i ()));
00215   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00216 #endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */
00217 }
00218 
00219 template <class TYPE, class ACE_LOCK> ACE_TSS_Singleton<TYPE, ACE_LOCK> *&
00220 ACE_TSS_Singleton<TYPE, ACE_LOCK>::instance_i (void)
00221 {
00222 #if defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
00223   // Pointer to the Singleton instance.  This works around a bug with
00224   // G++ and it's (mis-)handling of templates and statics...
00225   static ACE_TSS_Singleton<TYPE, ACE_LOCK> *singleton_ = 0;
00226 
00227   return singleton_;
00228 #else
00229   return ACE_TSS_Singleton<TYPE, ACE_LOCK>::singleton_;
00230 #endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */
00231 }
00232 
00233 template <class TYPE, class ACE_LOCK> TYPE *
00234 ACE_TSS_Singleton<TYPE, ACE_LOCK>::instance (void)
00235 {
00236   ACE_TRACE ("ACE_TSS_Singleton<TYPE, ACE_LOCK>::instance");
00237 
00238   ACE_TSS_Singleton<TYPE, ACE_LOCK> *&singleton =
00239     ACE_TSS_Singleton<TYPE, ACE_LOCK>::instance_i ();
00240 
00241   // Perform the Double-Check pattern...
00242   if (singleton == 0)
00243     {
00244       if (ACE_Object_Manager::starting_up () ||
00245           ACE_Object_Manager::shutting_down ())
00246         {
00247           // The program is still starting up, and therefore assumed
00248           // to be single threaded.  There's no need to double-check.
00249           // Or, the ACE_Object_Manager instance has been destroyed,
00250           // so the preallocated lock is not available.  Either way,
00251           // don't register for destruction with the
00252           // ACE_Object_Manager:  we'll have to leak this instance.
00253 
00254           ACE_NEW_RETURN (singleton, (ACE_TSS_Singleton<TYPE, ACE_LOCK>), 0);
00255         }
00256       else
00257         {
00258 #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
00259 
00260           // Obtain a lock from the ACE_Object_Manager.  The pointer
00261           // is static, so we only obtain one per ACE_Singleton instantiation.
00262           static ACE_LOCK *lock = 0;
00263           if (ACE_Object_Manager::get_singleton_lock (lock) != 0)
00264             // Failed to acquire the lock!
00265             return 0;
00266 
00267           ACE_GUARD_RETURN (ACE_LOCK, ace_mon, *lock, 0);
00268 
00269           if (singleton == 0)
00270             {
00271 #endif /* ACE_MT_SAFE */
00272               ACE_NEW_RETURN (singleton, (ACE_TSS_Singleton<TYPE, ACE_LOCK>),
00273                               0);
00274 
00275               // Register for destruction with ACE_Object_Manager.
00276               ACE_Object_Manager::at_exit (singleton);
00277 #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
00278             }
00279 #endif /* ACE_MT_SAFE */
00280         }
00281     }
00282 
00283   return ACE_TSS_GET (&singleton->instance_, TYPE);
00284 }
00285 
00286 template <class TYPE, class ACE_LOCK> void
00287 ACE_TSS_Singleton<TYPE, ACE_LOCK>::cleanup (void *)
00288 {
00289   delete this;
00290   ACE_TSS_Singleton<TYPE, ACE_LOCK>::instance_i () = 0;
00291 }
00292 
00293 template <class TYPE, class ACE_LOCK> void
00294 ACE_Unmanaged_TSS_Singleton<TYPE, ACE_LOCK>::dump (void)
00295 {
00296   ACE_TRACE ("ACE_Unmanaged_TSS_Singleton<TYPE, ACE_LOCK>::dump");
00297 
00298 #if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
00299   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("instance_ = %x"),
00300               ACE_Unmanaged_TSS_Singleton<TYPE, ACE_LOCK>::instance_i ()));
00301   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00302 #endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */
00303 }
00304 
00305 template <class TYPE, class ACE_LOCK>
00306 ACE_Unmanaged_TSS_Singleton<TYPE, ACE_LOCK> *&
00307 ACE_Unmanaged_TSS_Singleton<TYPE, ACE_LOCK>::instance_i (void)
00308 {
00309 #if defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
00310   // Pointer to the Singleton instance.  This works around a bug with
00311   // G++ and it's (mis-)handling of templates and statics...
00312   static ACE_Unmanaged_TSS_Singleton<TYPE, ACE_LOCK> *singleton_ = 0;
00313 
00314   return singleton_;
00315 #else
00316   return ACE_Unmanaged_TSS_Singleton<TYPE, ACE_LOCK>::singleton_;
00317 #endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */
00318 }
00319 
00320 template <class TYPE, class ACE_LOCK> TYPE *
00321 ACE_Unmanaged_TSS_Singleton<TYPE, ACE_LOCK>::instance (void)
00322 {
00323   ACE_TRACE ("ACE_Unmanaged_TSS_Singleton<TYPE, ACE_LOCK>::instance");
00324 
00325   ACE_Unmanaged_TSS_Singleton<TYPE, ACE_LOCK> *&singleton =
00326     ACE_Unmanaged_TSS_Singleton<TYPE, ACE_LOCK>::instance_i ();
00327 
00328   // Perform the Double-Check pattern...
00329   if (singleton == 0)
00330     {
00331       if (ACE_Object_Manager::starting_up () ||
00332           ACE_Object_Manager::shutting_down ())
00333         {
00334           // The program is still starting up, and therefore assumed
00335           // to be single threaded.  There's no need to double-check.
00336           // Or, the ACE_Object_Manager instance has been destroyed,
00337           // so the preallocated lock is not available.  Either way,
00338           // don't register for destruction with the
00339           // ACE_Object_Manager:  we'll have to leak this instance.
00340 
00341           ACE_NEW_RETURN (singleton,
00342                           (ACE_Unmanaged_TSS_Singleton<TYPE, ACE_LOCK>),
00343                           0);
00344         }
00345       else
00346         {
00347 #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
00348           // Obtain a lock from the ACE_Object_Manager.  The pointer
00349           // is static, so we only obtain one per
00350           // ACE_Unmanaged_Singleton instantiation.
00351           static ACE_LOCK *lock = 0;
00352           if (ACE_Object_Manager::get_singleton_lock (lock) != 0)
00353             // Failed to acquire the lock!
00354             return 0;
00355 
00356           ACE_GUARD_RETURN (ACE_LOCK, ace_mon, *lock, 0);
00357 #endif /* ACE_MT_SAFE */
00358 
00359           if (singleton == 0)
00360             ACE_NEW_RETURN (singleton,
00361                             (ACE_Unmanaged_TSS_Singleton<TYPE, ACE_LOCK>),
00362                             0);
00363         }
00364     }
00365 
00366   return ACE_TSS_GET (&singleton->instance_, TYPE);
00367 }
00368 
00369 template <class TYPE, class ACE_LOCK> void
00370 ACE_Unmanaged_TSS_Singleton<TYPE, ACE_LOCK>::close (void)
00371 {
00372   ACE_Unmanaged_TSS_Singleton<TYPE, ACE_LOCK> *&singleton =
00373     ACE_Unmanaged_TSS_Singleton<TYPE, ACE_LOCK>::instance_i ();
00374 
00375   if (singleton)
00376     singleton->cleanup ();
00377 }
00378 
00379 #if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
00380 // Pointer to the Singleton instance.
00381 template <class TYPE, class ACE_LOCK> ACE_TSS_Singleton <TYPE, ACE_LOCK> *
00382 ACE_TSS_Singleton<TYPE, ACE_LOCK>::singleton_ = 0;
00383 
00384 template <class TYPE, class ACE_LOCK>
00385 ACE_Unmanaged_TSS_Singleton<TYPE, ACE_LOCK> *
00386 ACE_Unmanaged_TSS_Singleton<TYPE, ACE_LOCK>::singleton_ = 0;
00387 #endif /* !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) */
00388 
00389 /*************************************************************************/
00390 
00391 #if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
00392 // Pointer to the Singleton instance.
00393 template <class TYPE, class ACE_LOCK> ACE_DLL_Singleton_T<TYPE, ACE_LOCK> *
00394 ACE_DLL_Singleton_T<TYPE, ACE_LOCK>::singleton_ = 0;
00395 #endif /* !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) */
00396 
00397 template <class TYPE, class ACE_LOCK> void
00398 ACE_DLL_Singleton_T<TYPE, ACE_LOCK>::dump (void)
00399 {
00400   ACE_TRACE ("ACE_DLL_Singleton_T<TYPE, ACE_LOCK>::dump");
00401 
00402 #if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
00403   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("instance_ = %x"),
00404               ACE_DLL_Singleton_T<TYPE, ACE_LOCK>::instance_i ()));
00405   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00406 #endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */
00407 }
00408 
00409 template <class TYPE, class ACE_LOCK>
00410 ACE_DLL_Singleton_T<TYPE, ACE_LOCK> *&
00411 ACE_DLL_Singleton_T<TYPE, ACE_LOCK>::instance_i (void)
00412 {
00413   ACE_TRACE ("ACE_DLL_Singleton_T<TYPE, ACE_LOCK>::instance_i");
00414 
00415 #if defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
00416   // Pointer to the Singleton instance.  This works around a bug with
00417   // G++ and it's (mis-)handling of templates and statics...
00418   static ACE_DLL_Singleton_T<TYPE, ACE_LOCK> *singleton_ = 0;
00419 
00420   return singleton_;
00421 #else
00422   return ACE_DLL_Singleton_T<TYPE, ACE_LOCK>::singleton_;
00423 #endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */
00424 }
00425 
00426 template <class TYPE, class ACE_LOCK> TYPE *
00427 ACE_DLL_Singleton_T<TYPE, ACE_LOCK>::instance (void)
00428 {
00429   ACE_TRACE ("ACE_DLL_Singleton_T<TYPE, ACE_LOCK>::instance");
00430 
00431   ACE_DLL_Singleton_T<TYPE, ACE_LOCK> *&singleton =
00432     ACE_DLL_Singleton_T<TYPE, ACE_LOCK>::instance_i ();
00433 
00434   // Perform the Double-Check pattern...
00435   if (singleton == 0)
00436     {
00437       if (ACE_Object_Manager::starting_up () ||
00438           ACE_Object_Manager::shutting_down ())
00439         {
00440           // The program is still starting up, and therefore assumed
00441           // to be single threaded.  There's no need to double-check.
00442           // Or, the ACE_Object_Manager instance has been destroyed,
00443           // so the preallocated lock is not available.  Either way,
00444           // don't register for destruction with the
00445           // ACE_Object_Manager:  we'll have to leak this instance.
00446 
00447           ACE_NEW_RETURN (singleton, (ACE_DLL_Singleton_T<TYPE, ACE_LOCK>),
00448                           0);
00449         }
00450       else
00451         {
00452 #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
00453           // Obtain a lock from the ACE_Object_Manager.  The pointer
00454           // is static, so we only obtain one per
00455           // ACE_Unmanaged_Singleton instantiation.
00456           static ACE_LOCK *lock = 0;
00457           if (ACE_Object_Manager::get_singleton_lock (lock) != 0)
00458             // Failed to acquire the lock!
00459             return 0;
00460 
00461           ACE_GUARD_RETURN (ACE_LOCK, ace_mon, *lock, 0);
00462 #endif /* ACE_MT_SAFE */
00463 
00464           if (singleton == 0)
00465             ACE_NEW_RETURN (singleton,
00466                             (ACE_DLL_Singleton_T<TYPE, ACE_LOCK>),
00467                             0);
00468         }
00469       //ACE_REGISTER_FRAMEWORK_COMPONENT(ACE_DLL_Singleton<TYPE,ACE_LOCK>, singleton);
00470       ACE_Framework_Repository::instance ()->register_component
00471         (new ACE_Framework_Component_T<ACE_DLL_Singleton_T<TYPE, ACE_LOCK> > (singleton));
00472     }
00473 
00474   return &singleton->instance_;
00475 }
00476 
00477 template <class TYPE, class ACE_LOCK> void
00478 ACE_DLL_Singleton_T<TYPE, ACE_LOCK>::close (void)
00479 {
00480   ACE_TRACE ("ACE_DLL_Singleton_T<TYPE, ACE_LOCK>::close");
00481 
00482   ACE_DLL_Singleton_T<TYPE, ACE_LOCK> *&singleton =
00483     ACE_DLL_Singleton_T<TYPE, ACE_LOCK>::instance_i ();
00484 
00485   delete singleton;
00486   singleton = 0;
00487 }
00488 
00489 template <class TYPE, class ACE_LOCK> void
00490 ACE_DLL_Singleton_T<TYPE, ACE_LOCK>::close_singleton (void)
00491 {
00492   ACE_TRACE ("ACE_DLL_Singleton_T<TYPE, ACE_LOCK>::close_singleton");
00493   ACE_DLL_Singleton_T<TYPE, ACE_LOCK>::close ();
00494 }
00495 
00496 template <class TYPE, class ACE_LOCK> const ACE_TCHAR *
00497 ACE_DLL_Singleton_T<TYPE, ACE_LOCK>::dll_name (void)
00498 {
00499   return this->instance ()->dll_name ();
00500 }
00501  
00502 template <class TYPE, class ACE_LOCK> const ACE_TCHAR *
00503 ACE_DLL_Singleton_T<TYPE, ACE_LOCK>::name (void)
00504 {
00505   return this->instance ()->name ();
00506 }
00507 
00508 
00509 /**********************************************************************/
00510 
00511 template <class TYPE> const ACE_TCHAR*
00512 ACE_DLL_Singleton_Adapter_T<TYPE>::dll_name (void) 
00513 {
00514   // @todo make this a constant somewhere (or it there already is one
00515   // then use it.
00516   return ACE_TEXT("ACE");
00517 }
00518 
00519 #endif /* ACE_SINGLETON_C */

Generated on Mon Jun 16 11:21:16 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002