sp_win32_sleep.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef BOOST_CORE_DETAIL_SP_WIN32_SLEEP_HPP_INCLUDED
  2. #define BOOST_CORE_DETAIL_SP_WIN32_SLEEP_HPP_INCLUDED
  3. // MS compatible compilers support #pragma once
  4. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  5. # pragma once
  6. #endif
  7. // boost/core/detail/sp_win32_sleep.hpp
  8. //
  9. // Declares the Win32 Sleep() function.
  10. //
  11. // Copyright 2008, 2020 Peter Dimov
  12. // Distributed under the Boost Software License, Version 1.0
  13. // https://www.boost.org/LICENSE_1_0.txt
  14. #if defined( BOOST_USE_WINDOWS_H )
  15. # include <windows.h>
  16. #endif
  17. namespace boost
  18. {
  19. namespace core
  20. {
  21. namespace detail
  22. {
  23. #if !defined( BOOST_USE_WINDOWS_H )
  24. #if defined(__clang__) && defined(__x86_64__)
  25. // clang x64 warns that __stdcall is ignored
  26. # define BOOST_CORE_SP_STDCALL
  27. #else
  28. # define BOOST_CORE_SP_STDCALL __stdcall
  29. #endif
  30. #if defined(__LP64__) // Cygwin 64
  31. extern "C" __declspec(dllimport) void BOOST_CORE_SP_STDCALL Sleep( unsigned int ms );
  32. #else
  33. extern "C" __declspec(dllimport) void BOOST_CORE_SP_STDCALL Sleep( unsigned long ms );
  34. #endif
  35. extern "C" __declspec(dllimport) int BOOST_CORE_SP_STDCALL SwitchToThread();
  36. #undef BOOST_CORE_SP_STDCALL
  37. #endif // !defined( BOOST_USE_WINDOWS_H )
  38. } // namespace detail
  39. } // namespace core
  40. } // namespace boost
  41. #endif // #ifndef BOOST_CORE_DETAIL_SP_WIN32_SLEEP_HPP_INCLUDED