summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2010-05-28 15:13:30 -0700
committerMathias Agopian <mathias@google.com>2010-05-28 15:13:30 -0700
commitb8510b98b5eb92333157db1359df6f2bbbfb2b39 (patch)
tree8eaef6ec93cd4ee29edb8b28b72d4f1d204e0d99 /include
parent26acf3fa06303f43b591ab149adcf3831b24fd41 (diff)
downloadframeworks_native-b8510b98b5eb92333157db1359df6f2bbbfb2b39.zip
frameworks_native-b8510b98b5eb92333157db1359df6f2bbbfb2b39.tar.gz
frameworks_native-b8510b98b5eb92333157db1359df6f2bbbfb2b39.tar.bz2
Fix a typo in Singleton<>
it could cause the sLock field to be emitted several times in different compilation unit. it also prevented to have 2 Singleton<> in the same file.
Diffstat (limited to 'include')
-rw-r--r--include/utils/Singleton.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/utils/Singleton.h b/include/utils/Singleton.h
index bc7626a..3b975b4 100644
--- a/include/utils/Singleton.h
+++ b/include/utils/Singleton.h
@@ -54,11 +54,13 @@ private:
* (eg: <TYPE>.cpp) to create the static instance of Singleton<>'s attributes,
* and avoid to have a copy of them in each compilation units Singleton<TYPE>
* is used.
+ * NOTE: we use a version of Mutex ctor that takes a parameter, because
+ * for some unknown reason using the default ctor doesn't emit the variable!
*/
-#define ANDROID_SINGLETON_STATIC_INSTANCE(TYPE) \
- template class Singleton< TYPE >; \
- template< class TYPE > Mutex Singleton< TYPE >::sLock; \
+#define ANDROID_SINGLETON_STATIC_INSTANCE(TYPE) \
+ template class Singleton< TYPE >; \
+ template<> Mutex Singleton< TYPE >::sLock(Mutex::PRIVATE); \
template<> TYPE* Singleton< TYPE >::sInstance(0);