diff options
author | Derek Mauro <761129+derekmauro@users.noreply.github.com> | 2021-06-01 10:52:49 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-01 10:52:49 -0400 |
commit | 278e0a071885a22dcd2fd1b5576cc44757299343 (patch) | |
tree | 2f50d910df44a77d0ace291ce84e13c9fbdc0162 /absl/base/internal/thread_identity.h | |
parent | e1d388e7e74803050423d035e4374131b9b57919 (diff) |
Abseil LTS 20210324, Patch 220210324.2
* Fixes build with glibc 2.34 (#952)
* Fixes "illegal thread local variable" on some Apple platforms (#954, #965)
Diffstat (limited to 'absl/base/internal/thread_identity.h')
-rw-r--r-- | absl/base/internal/thread_identity.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/absl/base/internal/thread_identity.h b/absl/base/internal/thread_identity.h index 9ee651a3..6e25b92f 100644 --- a/absl/base/internal/thread_identity.h +++ b/absl/base/internal/thread_identity.h @@ -236,13 +236,18 @@ ABSL_CONST_INIT extern thread_local ThreadIdentity* thread_identity_ptr; #error Thread-local storage not detected on this platform #endif -// thread_local variables cannot be in headers exposed by DLLs. However, it is -// important for performance reasons in general that -// `CurrentThreadIdentityIfPresent` be inlined. This is not possible across a -// DLL boundary so, with DLLs, we opt to have the function not be inlined. Note +// thread_local variables cannot be in headers exposed by DLLs or in certain +// build configurations on Apple platforms. However, it is important for +// performance reasons in general that `CurrentThreadIdentityIfPresent` be +// inlined. In the other cases we opt to have the function not be inlined. Note // that `CurrentThreadIdentityIfPresent` is declared above so we can exclude -// this entire inline definition when compiling as a DLL. -#if !defined(ABSL_BUILD_DLL) && !defined(ABSL_CONSUME_DLL) +// this entire inline definition. +#if !defined(__APPLE__) && !defined(ABSL_BUILD_DLL) && \ + !defined(ABSL_CONSUME_DLL) +#define ABSL_INTERNAL_INLINE_CURRENT_THREAD_IDENTITY_IF_PRESENT 1 +#endif + +#ifdef ABSL_INTERNAL_INLINE_CURRENT_THREAD_IDENTITY_IF_PRESENT inline ThreadIdentity* CurrentThreadIdentityIfPresent() { return thread_identity_ptr; } |