OPEN-282 - Define LL_THREAD_LOCAL for our platforms in order to unify TLS support

master
Cinder 2014-11-19 22:27:36 -07:00
parent 5f608c0a23
commit 6df6aef621
3 changed files with 8 additions and 17 deletions

View File

@ -101,6 +101,11 @@
#endif
#if LL_WINDOWS
# define LL_THREAD_LOCAL __declspec(thread)
#else
# define LL_THREAD_LOCAL __thread
#endif
// Static linking with apr on windows needs to be declared.
#if LL_WINDOWS && !LL_COMMON_LINK_SHARED

View File

@ -92,11 +92,7 @@ void set_thread_name( DWORD dwThreadID, const char* threadName)
//
//----------------------------------------------------------------------------
#if LL_WINDOWS
U32 __declspec(thread) sThreadID = 0;
#else
U32 __thread sThreadID = 0;
#endif
U32 LL_THREAD_LOCAL sThreadID = 0;
U32 LLThread::sIDIter = 0;

View File

@ -139,20 +139,10 @@ public:
}
private:
#if LL_WINDOWS
static __declspec(thread) DERIVED_TYPE* sInstance;
#else
static __thread DERIVED_TYPE* sInstance;
#endif
static LL_THREAD_LOCAL DERIVED_TYPE* sInstance;
};
#if LL_WINDOWS
template<typename DERIVED_TYPE>
__declspec(thread) DERIVED_TYPE* LLThreadLocalSingletonPointer<DERIVED_TYPE>::sInstance = NULL;
#else
template<typename DERIVED_TYPE>
__thread DERIVED_TYPE* LLThreadLocalSingletonPointer<DERIVED_TYPE>::sInstance = NULL;
#endif
LL_THREAD_LOCAL DERIVED_TYPE* LLThreadLocalSingletonPointer<DERIVED_TYPE>::sInstance = NULL;
#endif // LL_LLTHREADLOCALSTORAGE_H