22 #ifndef __M2ETIS_UTIL_SINGLETON_H__
23 #define __M2ETIS_UTIL_SINGLETON_H__
27 #include "boost/interprocess/sync/scoped_lock.hpp"
28 #include "boost/thread.hpp"
57 boost::unique_lock<boost::mutex> lock(
_objMutex);
71 boost::unique_lock<boost::mutex> lock(_objMutex);
73 _ptrSingleton =
new T();
82 template<
typename T> T * Singleton<T>::_ptrSingleton =
nullptr;
83 template<
typename T> boost::mutex Singleton<T>::_objMutex;
static T & GetSingleton()
static boost::mutex _objMutex
Derive from this templated class to make a class a singleton. Refer to the Singleton Design Pattern i...
static T * GetSingletonPtr()