tls.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. #include <boost/winapi/detail/header.hpp>
  15. #if !defined( BOOST_USE_WINDOWS_H )
  16. extern "C" {
  17. #if !defined( UNDER_CE )
  18. // Windows CE define TlsAlloc and TlsFree as inline functions in kfuncs.h
  19. BOOST_WINAPI_IMPORT boost::winapi::DWORD_ BOOST_WINAPI_WINAPI_CC
  20. TlsAlloc(BOOST_WINAPI_DETAIL_VOID);
  21. BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
  22. TlsFree(boost::winapi::DWORD_ dwTlsIndex);
  23. #endif
  24. BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::LPVOID_ BOOST_WINAPI_WINAPI_CC
  25. TlsGetValue(boost::winapi::DWORD_ dwTlsIndex);
  26. BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
  27. TlsSetValue(
  28. boost::winapi::DWORD_ dwTlsIndex,
  29. boost::winapi::LPVOID_ lpTlsValue);
  30. } // extern "C"
  31. #endif
  32. namespace boost {
  33. namespace winapi {
  34. using ::TlsAlloc;
  35. using ::TlsFree;
  36. using ::TlsGetValue;
  37. using ::TlsSetValue;
  38. #if defined( BOOST_USE_WINDOWS_H )
  39. BOOST_CONSTEXPR_OR_CONST DWORD_ TLS_OUT_OF_INDEXES_ = TLS_OUT_OF_INDEXES;
  40. #else
  41. BOOST_CONSTEXPR_OR_CONST DWORD_ TLS_OUT_OF_INDEXES_ = 0xFFFFFFFF;
  42. #endif
  43. BOOST_CONSTEXPR_OR_CONST DWORD_ tls_out_of_indexes = TLS_OUT_OF_INDEXES_;
  44. }
  45. }
  46. #include <boost/winapi/detail/footer.hpp>
  47. #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM
  48. #endif // BOOST_WINAPI_TLS_HPP_INCLUDED_