diff options
Diffstat (limited to 'absl/base/internal/thread_identity.h')
-rw-r--r-- | absl/base/internal/thread_identity.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/absl/base/internal/thread_identity.h b/absl/base/internal/thread_identity.h index b34674a62d4b..7cbce9cc8e02 100644 --- a/absl/base/internal/thread_identity.h +++ b/absl/base/internal/thread_identity.h @@ -224,7 +224,14 @@ void ClearCurrentThreadIdentity(); #if ABSL_THREAD_IDENTITY_MODE == ABSL_THREAD_IDENTITY_MODE_USE_TLS || \ ABSL_THREAD_IDENTITY_MODE == ABSL_THREAD_IDENTITY_MODE_USE_CPP11 -extern ABSL_PER_THREAD_TLS_KEYWORD ThreadIdentity* thread_identity_ptr; +#if ABSL_PER_THREAD_TLS +ABSL_CONST_INIT extern ABSL_PER_THREAD_TLS_KEYWORD ThreadIdentity* + thread_identity_ptr; +#elif defined(ABSL_HAVE_THREAD_LOCAL) +ABSL_CONST_INIT extern thread_local ThreadIdentity* thread_identity_ptr; +#else +#error Thread-local storage not detected on this platform +#endif inline ThreadIdentity* CurrentThreadIdentityIfPresent() { return thread_identity_ptr; |