123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- #ifndef BOOST_LEAF_CONFIG_TLS_GLOBALS_HPP_INCLUDED
- #define BOOST_LEAF_CONFIG_TLS_GLOBALS_HPP_INCLUDED
- #include <cstdint>
- namespace boost { namespace leaf {
- namespace leaf_detail
- {
- using atomic_unsigned_int = unsigned int;
- }
- namespace tls
- {
- template <class T>
- struct BOOST_LEAF_SYMBOL_VISIBLE ptr
- {
- static T * p;
- };
- template <class T>
- T * ptr<T>::p;
- template <class T>
- T * read_ptr() noexcept
- {
- return ptr<T>::p;
- }
- template <class T>
- void write_ptr( T * p ) noexcept
- {
- ptr<T>::p = p;
- }
-
- template <class Tag>
- struct BOOST_LEAF_SYMBOL_VISIBLE tagged_uint
- {
- static unsigned x;
- };
- template <class Tag>
- unsigned tagged_uint<Tag>::x;
- template <class Tag>
- unsigned read_uint() noexcept
- {
- return tagged_uint<Tag>::x;
- }
- template <class Tag>
- void write_uint( unsigned x ) noexcept
- {
- tagged_uint<Tag>::x = x;
- }
- template <class Tag>
- void uint_increment() noexcept
- {
- ++tagged_uint<Tag>::x;
- }
- template <class Tag>
- void uint_decrement() noexcept
- {
- --tagged_uint<Tag>::x;
- }
- }
- } }
- #endif
|