diff options
author | Oz Linden <oz@lindenlab.com> | 2015-06-08 16:33:02 -0400 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2015-06-08 16:33:02 -0400 |
commit | 949942c730b0b7463338c2cb3bc411ac12f4f648 (patch) | |
tree | 159b9cf6bb6a9de9b538f17e3d721be25a15b79a /indra/llcommon/llthreadlocalstorage.h | |
parent | a219cf1c98527faa0e7addeb9660f679208bb0e7 (diff) | |
parent | f3c58f765c0168f25bb13c4427e34b4bdad2f671 (diff) |
merge changes for 3.7.29-release
Diffstat (limited to 'indra/llcommon/llthreadlocalstorage.h')
-rw-r--r-- | indra/llcommon/llthreadlocalstorage.h | 41 |
1 files changed, 2 insertions, 39 deletions
diff --git a/indra/llcommon/llthreadlocalstorage.h b/indra/llcommon/llthreadlocalstorage.h index ec3b52c8cb..3b5786023f 100644 --- a/indra/llcommon/llthreadlocalstorage.h +++ b/indra/llcommon/llthreadlocalstorage.h @@ -130,56 +130,19 @@ class LLThreadLocalSingletonPointer public: LL_FORCE_INLINE static DERIVED_TYPE* getInstance() { -#if LL_DARWIN - createTLSKey(); - return (DERIVED_TYPE*)pthread_getspecific(sInstanceKey); -#else return sInstance; -#endif } static void setInstance(DERIVED_TYPE* instance) { -#if LL_DARWIN - createTLSKey(); - pthread_setspecific(sInstanceKey, (void*)instance); -#else sInstance = instance; -#endif } private: - -#if LL_WINDOWS - static __declspec(thread) DERIVED_TYPE* sInstance; -#elif LL_LINUX - static __thread DERIVED_TYPE* sInstance; -#elif LL_DARWIN - static void TLSError() - { - LL_ERRS() << "Could not create thread local storage" << LL_ENDL; - } - static void createTLSKey() - { - static S32 key_created = pthread_key_create(&sInstanceKey, NULL); - if (key_created != 0) - { - LL_ERRS() << "Could not create thread local storage" << LL_ENDL; - } - } - static pthread_key_t sInstanceKey; -#endif + static LL_THREAD_LOCAL DERIVED_TYPE* sInstance; }; -#if LL_WINDOWS -template<typename DERIVED_TYPE> -__declspec(thread) DERIVED_TYPE* LLThreadLocalSingletonPointer<DERIVED_TYPE>::sInstance = NULL; -#elif LL_LINUX -template<typename DERIVED_TYPE> -__thread DERIVED_TYPE* LLThreadLocalSingletonPointer<DERIVED_TYPE>::sInstance = NULL; -#elif LL_DARWIN template<typename DERIVED_TYPE> -pthread_key_t LLThreadLocalSingletonPointer<DERIVED_TYPE>::sInstanceKey; -#endif +LL_THREAD_LOCAL DERIVED_TYPE* LLThreadLocalSingletonPointer<DERIVED_TYPE>::sInstance = NULL; #endif // LL_LLTHREADLOCALSTORAGE_H |