File indexing completed on 2025-12-16 09:44:34
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_COMPUTE_DETAIL_GLOBAL_STATIC_HPP
0012 #define BOOST_COMPUTE_DETAIL_GLOBAL_STATIC_HPP
0013
0014 #include <boost/compute/config.hpp>
0015
0016 #ifdef BOOST_COMPUTE_THREAD_SAFE
0017 # ifdef BOOST_COMPUTE_HAVE_THREAD_LOCAL
0018
0019 # define BOOST_COMPUTE_DETAIL_GLOBAL_STATIC(type, name, ctor) \
0020 thread_local type name ctor;
0021 # else
0022
0023 # include <boost/thread/tss.hpp>
0024 # define BOOST_COMPUTE_DETAIL_GLOBAL_STATIC(type, name, ctor) \
0025 static ::boost::thread_specific_ptr< type > BOOST_PP_CAT(name, _tls_ptr_); \
0026 if(!BOOST_PP_CAT(name, _tls_ptr_).get()){ \
0027 BOOST_PP_CAT(name, _tls_ptr_).reset(new type ctor); \
0028 } \
0029 static type &name = *BOOST_PP_CAT(name, _tls_ptr_);
0030 # endif
0031 #else
0032
0033 # define BOOST_COMPUTE_DETAIL_GLOBAL_STATIC(type, name, ctor) \
0034 static type name ctor;
0035 #endif
0036
0037 #endif