CMS 3D CMS Logo

Static Public Member Functions | Static Private Member Functions

ThreadSingleton< T, F > Class Template Reference

#include <MutexUtils.h>

List of all members.

Static Public Member Functions

static Tinstance (F &f=factory())

Static Private Member Functions

static TbuildMe (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().

                          {
    return f();
  }
template<typename T , typename F = defF<T>>
static F& ThreadSingleton< T, F >::factory ( ) [inline, static, private]

Definition at line 166 of file MutexUtils.h.

References F(), and f.

                       {
    static F f;
    return f;
  }
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, and lumiQTWidget::t.

                                     {
    static boost::thread_specific_ptr<T> me;
    if (!me.get()) {
      T * t = buildMe(f);
      me.reset(t);
    }
    return *me;
  }