summaryrefslogtreecommitdiff
path: root/indra/llcommon/llthreadlocalstorage.h
diff options
context:
space:
mode:
authorCinder <cinder@sdf.org>2014-11-19 08:01:28 -0700
committerCinder <cinder@sdf.org>2014-11-19 08:01:28 -0700
commit5f608c0a23487ae78cdc134b1e685a6c3cd4ec19 (patch)
tree92c7f33bf9009533c96da91680b0b0583d822e48 /indra/llcommon/llthreadlocalstorage.h
parenta74d0d44d15d5cdc8f86b1b80153721415afa82e (diff)
OPEN-282 Use pthreads for TLS on mac
Diffstat (limited to 'indra/llcommon/llthreadlocalstorage.h')
-rw-r--r--indra/llcommon/llthreadlocalstorage.h31
1 files changed, 2 insertions, 29 deletions
diff --git a/indra/llcommon/llthreadlocalstorage.h b/indra/llcommon/llthreadlocalstorage.h
index ec3b52c8cb..da648902aa 100644
--- a/indra/llcommon/llthreadlocalstorage.h
+++ b/indra/llcommon/llthreadlocalstorage.h
@@ -130,56 +130,29 @@ 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
+#else
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
};
#if LL_WINDOWS
template<typename DERIVED_TYPE>
__declspec(thread) DERIVED_TYPE* LLThreadLocalSingletonPointer<DERIVED_TYPE>::sInstance = NULL;
-#elif LL_LINUX
+#else
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
#endif // LL_LLTHREADLOCALSTORAGE_H