HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_Singleton< T, DESTRUCTONEXIT > Class Template Reference

#include <UT_Singleton.h>

+ Inheritance diagram for UT_Singleton< T, DESTRUCTONEXIT >:

Public Member Functions

 UT_Singleton ()
 
 ~UT_Singleton ()
 
template<class LOCK >
Tget (LOCK &lock)
 
template<class LOCK , typename S >
Tget (LOCK &lock, S s)
 
template<class LOCK >
void unsafeSet (LOCK &lock, T *newp)
 

Detailed Description

template<typename T, bool DESTRUCTONEXIT = false>
class UT_Singleton< T, DESTRUCTONEXIT >

This is the same as UT_SingletonWithLock, except referencing an existing lock in get(), instead of holding its own. This can be useful for avoiding having many locks as member variables when using UT_Singleton for pointer member variables that are allocated on-demand, or if another lock would need to be acquired in order to run new T().

Definition at line 132 of file UT_Singleton.h.

Constructor & Destructor Documentation

template<typename T, bool DESTRUCTONEXIT = false>
UT_Singleton< T, DESTRUCTONEXIT >::UT_Singleton ( )
inline

Definition at line 135 of file UT_Singleton.h.

template<typename T, bool DESTRUCTONEXIT = false>
UT_Singleton< T, DESTRUCTONEXIT >::~UT_Singleton ( )
inline

Definition at line 136 of file UT_Singleton.h.

Member Function Documentation

template<typename T, bool DESTRUCTONEXIT = false>
template<class LOCK >
T& UT_Singleton< T, DESTRUCTONEXIT >::get ( LOCK &  lock)
inline

Definition at line 145 of file UT_Singleton.h.

template<typename T, bool DESTRUCTONEXIT = false>
template<class LOCK , typename S >
T& UT_Singleton< T, DESTRUCTONEXIT >::get ( LOCK &  lock,
S  s 
)
inline

Definition at line 151 of file UT_Singleton.h.

template<typename T, bool DESTRUCTONEXIT = false>
template<class LOCK >
void UT_Singleton< T, DESTRUCTONEXIT >::unsafeSet ( LOCK &  lock,
T newp 
)
inline

NOTE: Even though unsafeSet locks, it is still unsafe, because other threads may have called get(), gotten a valid pointer, and be using it when unsafeSet destructs it.

Definition at line 160 of file UT_Singleton.h.


The documentation for this class was generated from the following file: