diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h
index 309165da7f4a76413f9f8b6074e4683aa5d5c315..2c4bcc91f6e96ec41c8e6b588de038025a3fc807 100755
--- a/indra/llcommon/llpreprocessor.h
+++ b/indra/llcommon/llpreprocessor.h
@@ -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
diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp
index 22e8179b6cc0725417946c9e6bc3495bbd5b9be3..c3f235c6ee3c78d80e19a38f1093653dcee40721 100755
--- a/indra/llcommon/llthread.cpp
+++ b/indra/llcommon/llthread.cpp
@@ -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;
 
diff --git a/indra/llcommon/llthreadlocalstorage.h b/indra/llcommon/llthreadlocalstorage.h
index da648902aa2433ae8bb3d06b144b381a820ed8d2..3b5786023f45fe9b8b36423da9fbfbf36869bac0 100644
--- a/indra/llcommon/llthreadlocalstorage.h
+++ b/indra/llcommon/llthreadlocalstorage.h
@@ -139,20 +139,10 @@ class LLThreadLocalSingletonPointer
 	}
 
 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