tls.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // tls.hpp --------------------------------------------------------------//
  2. // Copyright 2013 Andrey Semashev
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // See http://www.boost.org/LICENSE_1_0.txt
  5. #ifndef BOOST_DETAIL_WINAPI_TLS_HPP
  6. #define BOOST_DETAIL_WINAPI_TLS_HPP
  7. #include <boost/detail/winapi/basic_types.hpp>
  8. #ifdef BOOST_HAS_PRAGMA_ONCE
  9. #pragma once
  10. #endif
  11. #if !defined( BOOST_USE_WINDOWS_H )
  12. extern "C" {
  13. #if !defined( UNDER_CE )
  14. // Windows CE define TlsAlloc and TlsFree as inline functions in kfuncs.h
  15. BOOST_SYMBOL_IMPORT boost::detail::winapi::DWORD_ WINAPI
  16. TlsAlloc(BOOST_DETAIL_WINAPI_VOID);
  17. BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI
  18. TlsFree(boost::detail::winapi::DWORD_ dwTlsIndex);
  19. #endif
  20. BOOST_SYMBOL_IMPORT boost::detail::winapi::LPVOID_ WINAPI
  21. TlsGetValue(boost::detail::winapi::DWORD_ dwTlsIndex);
  22. BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI
  23. TlsSetValue(
  24. boost::detail::winapi::DWORD_ dwTlsIndex,
  25. boost::detail::winapi::LPVOID_ lpTlsValue);
  26. }
  27. #endif
  28. namespace boost {
  29. namespace detail {
  30. namespace winapi {
  31. using ::TlsAlloc;
  32. using ::TlsFree;
  33. using ::TlsGetValue;
  34. using ::TlsSetValue;
  35. #if defined( BOOST_USE_WINDOWS_H )
  36. const DWORD_ TLS_OUT_OF_INDEXES_ = TLS_OUT_OF_INDEXES;
  37. #else
  38. const DWORD_ TLS_OUT_OF_INDEXES_ = 0xFFFFFFFF;
  39. #endif
  40. const DWORD_ tls_out_of_indexes = TLS_OUT_OF_INDEXES_;
  41. }
  42. }
  43. }
  44. #endif // BOOST_DETAIL_WINAPI_TLS_HPP