template<class T>
class Celartem::ThreadSafeSingleton< T >
This class provides a way to initialize a singleton instance in
thread-safe manner.\n
A class, which provides a singleton instance, should inherit this
class as a base class like the following sample:
class SingletonSample : public ThreadSafeSingleton
{
public:
....
};
SingletonSample& singleton = SingletonSample::getSingletonInstance();
For a real-world example, the following code is a static initializer
of a mutex instance:
class MyMutexInit : public ThreadSafeSingleton<MyMutexInit>
{
Mutex m_mutex;
Mutex& getMutexM() { return m_mutex; }
public:
static Mutex& getMutex()
{
return getSingletonInstance().getMutexM();
}
};
\sa ThreadSafeSingletonReferable
\sa cel_once