tls.hpp 1.5 KB

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