Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:40:42

0001 // Copyright 2017 The Abseil Authors.
0002 //
0003 // Licensed under the Apache License, Version 2.0 (the "License");
0004 // you may not use this file except in compliance with the License.
0005 // You may obtain a copy of the License at
0006 //
0007 //      https://www.apache.org/licenses/LICENSE-2.0
0008 //
0009 // Unless required by applicable law or agreed to in writing, software
0010 // distributed under the License is distributed on an "AS IS" BASIS,
0011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0012 // See the License for the specific language governing permissions and
0013 // limitations under the License.
0014 
0015 #ifndef ABSL_BASE_INTERNAL_PER_THREAD_TLS_H_
0016 #define ABSL_BASE_INTERNAL_PER_THREAD_TLS_H_
0017 
0018 // This header defines two macros:
0019 //
0020 // If the platform supports thread-local storage:
0021 //
0022 // * ABSL_PER_THREAD_TLS_KEYWORD is the C keyword needed to declare a
0023 //   thread-local variable
0024 // * ABSL_PER_THREAD_TLS is 1
0025 //
0026 // Otherwise:
0027 //
0028 // * ABSL_PER_THREAD_TLS_KEYWORD is empty
0029 // * ABSL_PER_THREAD_TLS is 0
0030 //
0031 // Microsoft C supports thread-local storage.
0032 // GCC supports it if the appropriate version of glibc is available,
0033 // which the programmer can indicate by defining ABSL_HAVE_TLS
0034 
0035 #include "absl/base/port.h"  // For ABSL_HAVE_TLS
0036 
0037 #if defined(ABSL_PER_THREAD_TLS)
0038 #error ABSL_PER_THREAD_TLS cannot be directly set
0039 #elif defined(ABSL_PER_THREAD_TLS_KEYWORD)
0040 #error ABSL_PER_THREAD_TLS_KEYWORD cannot be directly set
0041 #elif defined(ABSL_HAVE_TLS)
0042 #define ABSL_PER_THREAD_TLS_KEYWORD __thread
0043 #define ABSL_PER_THREAD_TLS 1
0044 #elif defined(_MSC_VER)
0045 #define ABSL_PER_THREAD_TLS_KEYWORD __declspec(thread)
0046 #define ABSL_PER_THREAD_TLS 1
0047 #else
0048 #define ABSL_PER_THREAD_TLS_KEYWORD
0049 #define ABSL_PER_THREAD_TLS 0
0050 #endif
0051 
0052 #endif  // ABSL_BASE_INTERNAL_PER_THREAD_TLS_H_