1 //  Copyright (c) 2018 Hartmut Kaiser
2 //
3 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
4 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 #if !defined(HPX_COMPILER_NATIVE_TLS)
7 #define HPX_COMPILER_NATIVE_TLS
8 
9 #include <hpx/config/defines.hpp>
10 
11 // don't #include ciso646 for MSVC as it contains '#define and &&' and similar
12 #if !defined(_MSC_VER)
13 #include <ciso646>
14 #endif
15 
16 #if defined(__has_feature)
17 #  if __has_feature(cxx_thread_local)
18 #    define HPX_NATIVE_TLS thread_local
19 #  endif
20 #elif defined(HPX_HAVE_CXX11_THREAD_LOCAL)
21 #  define HPX_NATIVE_TLS thread_local
22 #endif
23 
24 #if !defined(HPX_NATIVE_TLS)
25 #  if defined(_GLIBCXX_HAVE_TLS)
26 #    define HPX_NATIVE_TLS __thread
27 #  elif defined(HPX_WINDOWS)
28 #    define HPX_NATIVE_TLS __declspec(thread)
29 #  elif defined(__FreeBSD__) || (defined(__APPLE__) && defined(__MACH__))
30 #    define HPX_NATIVE_TLS __thread
31 #  elif defined(__clang__) && defined(HPX_COMPUTE_DEVICE_CODE)
32 #    define HPX_NATIVE_TLS __thread
33 #  else
34 #    error "Native thread local storage is not supported for this platform, please undefine HPX_HAVE_NATIVE_TLS"
35 #  endif
36 #endif
37 
38 #endif
39