List of all members
Celartem::ThreadSafeSingleton< T > Class Template Reference

#include <cel_singleton.h>

Detailed Description

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:
....
};
// the call is now fully thread-safe
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:
// MyMutexInit::getMutex() always return a valid Mutex instance.
static Mutex& getMutex()
{
return getSingletonInstance().getMutexM();
}
};
    \sa ThreadSafeSingletonReferable
    \sa cel_once

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

Cuminas DjVu SDK 3.0.33103
This document is made with doxygen 1.8.5 at Sun Dec 15 2013 19:38:06.
Cuminas Logo