#ifndef H_CELERO_THREADLOCAL_H #define H_CELERO_THREADLOCAL_H /// /// \author Ivan Shynkarenka /// /// \copyright Copyright 2015, 2016, 2017, 2018. 2019 John Farrier /// /// Licensed under the Apache License, Version 2.0 (the "License"); /// you may not use this file except in compliance with the License. /// You may obtain a copy of the License at /// /// http://www.apache.org/licenses/LICENSE-2.0 /// /// Unless required by applicable law or agreed to in writing, software /// distributed under the License is distributed on an "AS IS" BASIS, /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. /// See the License for the specific language governing permissions and /// limitations under the License. /// #ifndef thread_local #if __STDC_VERSION__ >= 201112 && !defined __STDC_NO_THREADS__ #define thread_local _Thread_local #elif defined _WIN32 && (defined _MSC_VER || defined __ICL || defined __DMC__ || defined __BORLANDC__) #define thread_local __declspec(thread) /* note that ICC (linux) and Clang are covered by __GNUC__ */ #elif defined __GNUC__ || defined __SUNPRO_C || defined __xlC__ #define thread_local __thread #else #error "Cannot define thread_local" #endif #endif #endif