CMS 3D CMS Logo

ThreadSingleton< T, F > Class Template Reference

#include <Utilities/General/interface/MutexUtils.h>

List of all members.

Static Public Member Functions

static T & instance (F &f=factory())

Static Private Member Functions

static T * buildMe (F &f)
static F & factory ()


Detailed Description

template<typename T, typename F = defF<T>>
class ThreadSingleton< T, F >

Definition at line 153 of file MutexUtils.h.


Member Function Documentation

template<typename T, typename F = defF<T>>
static T* ThreadSingleton< T, F >::buildMe ( F &  f  )  [inline, static, private]

Definition at line 171 of file MutexUtils.h.

References f.

Referenced by ThreadSingleton< T, F >::instance().

00171                           {
00172     return f();
00173   }

template<typename T, typename F = defF<T>>
static F& ThreadSingleton< T, F >::factory ( void   )  [inline, static, private]

Definition at line 166 of file MutexUtils.h.

References f.

00166                        {
00167     static F f;
00168     return f;
00169   }

template<typename T, typename F = defF<T>>
static T& ThreadSingleton< T, F >::instance ( F &  f = factory()  )  [inline, static]

Definition at line 156 of file MutexUtils.h.

References ThreadSingleton< T, F >::buildMe(), f, me, and t.

Referenced by TSafeOstream().

00156                                      {
00157     static boost::thread_specific_ptr<T> me;
00158     if (!me.get()) {
00159       T * t = buildMe(f);
00160       me.reset(t);
00161     }
00162     return *me;
00163   }


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:33:27 2009 for CMSSW by  doxygen 1.5.4