diff options
Diffstat (limited to 'include/utils/Singleton.h')
-rw-r--r-- | include/utils/Singleton.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/include/utils/Singleton.h b/include/utils/Singleton.h index ffc03cb5d..7cc4c18be 100644 --- a/include/utils/Singleton.h +++ b/include/utils/Singleton.h @@ -19,6 +19,7 @@ #include <stdint.h> #include <sys/types.h> +#include <utils/Mutex.h> #include <utils/threads.h> #include <cutils/compiler.h> @@ -45,8 +46,8 @@ public: } protected: - ~Singleton() { }; - Singleton() { }; + ~Singleton() { } + Singleton() { } private: Singleton(const Singleton&); @@ -55,6 +56,12 @@ private: static TYPE* sInstance; }; +template <typename TYPE> +Mutex Singleton<TYPE>::sLock; + +template <typename TYPE> +TYPE* Singleton<TYPE>::sInstance; + /* * use ANDROID_SINGLETON_STATIC_INSTANCE(TYPE) in your implementation file * (eg: <TYPE>.cpp) to create the static instance of Singleton<>'s attributes, |