wait.hpp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. * Copyright 2010 Vicente J. Botet Escriba
  3. * Copyright 2015 Andrey Semashev
  4. * Copyright 2017 James E. King, III
  5. *
  6. * Distributed under the Boost Software License, Version 1.0.
  7. * See http://www.boost.org/LICENSE_1_0.txt
  8. */
  9. #ifndef BOOST_WINAPI_WAIT_HPP_INCLUDED_
  10. #define BOOST_WINAPI_WAIT_HPP_INCLUDED_
  11. #include <boost/winapi/basic_types.hpp>
  12. #ifdef BOOST_HAS_PRAGMA_ONCE
  13. #pragma once
  14. #endif
  15. #if !defined( BOOST_USE_WINDOWS_H )
  16. extern "C" {
  17. #if BOOST_WINAPI_PARTITION_APP || BOOST_WINAPI_PARTITION_SYSTEM
  18. BOOST_SYMBOL_IMPORT boost::winapi::DWORD_ BOOST_WINAPI_WINAPI_CC
  19. WaitForSingleObjectEx(
  20. boost::winapi::HANDLE_ hHandle,
  21. boost::winapi::DWORD_ dwMilliseconds,
  22. boost::winapi::BOOL_ bAlertable);
  23. #endif
  24. #if BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM
  25. #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_NT4
  26. BOOST_SYMBOL_IMPORT boost::winapi::DWORD_ BOOST_WINAPI_WINAPI_CC
  27. SignalObjectAndWait(
  28. boost::winapi::HANDLE_ hObjectToSignal,
  29. boost::winapi::HANDLE_ hObjectToWaitOn,
  30. boost::winapi::DWORD_ dwMilliseconds,
  31. boost::winapi::BOOL_ bAlertable);
  32. #endif
  33. #endif
  34. #if BOOST_WINAPI_PARTITION_APP_SYSTEM
  35. BOOST_SYMBOL_IMPORT boost::winapi::DWORD_ BOOST_WINAPI_WINAPI_CC
  36. WaitForSingleObject(
  37. boost::winapi::HANDLE_ hHandle,
  38. boost::winapi::DWORD_ dwMilliseconds);
  39. BOOST_SYMBOL_IMPORT boost::winapi::DWORD_ BOOST_WINAPI_WINAPI_CC
  40. WaitForMultipleObjects(
  41. boost::winapi::DWORD_ nCount,
  42. boost::winapi::HANDLE_ const* lpHandles,
  43. boost::winapi::BOOL_ bWaitAll,
  44. boost::winapi::DWORD_ dwMilliseconds);
  45. BOOST_SYMBOL_IMPORT boost::winapi::DWORD_ BOOST_WINAPI_WINAPI_CC
  46. WaitForMultipleObjectsEx(
  47. boost::winapi::DWORD_ nCount,
  48. boost::winapi::HANDLE_ const* lpHandles,
  49. boost::winapi::BOOL_ bWaitAll,
  50. boost::winapi::DWORD_ dwMilliseconds,
  51. boost::winapi::BOOL_ bAlertable);
  52. #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM
  53. } // extern "C"
  54. #endif
  55. namespace boost {
  56. namespace winapi {
  57. #if BOOST_WINAPI_PARTITION_APP || BOOST_WINAPI_PARTITION_SYSTEM
  58. using ::WaitForSingleObjectEx;
  59. #endif
  60. #if BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM
  61. #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_NT4
  62. using ::SignalObjectAndWait;
  63. #endif
  64. #endif
  65. #if BOOST_WINAPI_PARTITION_APP_SYSTEM
  66. using ::WaitForMultipleObjects;
  67. using ::WaitForMultipleObjectsEx;
  68. using ::WaitForSingleObject;
  69. #endif
  70. #if defined( BOOST_USE_WINDOWS_H )
  71. BOOST_CONSTEXPR_OR_CONST DWORD_ INFINITE_ = INFINITE;
  72. BOOST_CONSTEXPR_OR_CONST DWORD_ WAIT_ABANDONED_ = WAIT_ABANDONED;
  73. BOOST_CONSTEXPR_OR_CONST DWORD_ WAIT_OBJECT_0_ = WAIT_OBJECT_0;
  74. BOOST_CONSTEXPR_OR_CONST DWORD_ WAIT_TIMEOUT_ = WAIT_TIMEOUT;
  75. BOOST_CONSTEXPR_OR_CONST DWORD_ WAIT_FAILED_ = WAIT_FAILED;
  76. #else // defined( BOOST_USE_WINDOWS_H )
  77. BOOST_CONSTEXPR_OR_CONST DWORD_ INFINITE_ = (DWORD_)0xFFFFFFFF;
  78. BOOST_CONSTEXPR_OR_CONST DWORD_ WAIT_ABANDONED_ = 0x00000080L;
  79. BOOST_CONSTEXPR_OR_CONST DWORD_ WAIT_OBJECT_0_ = 0x00000000L;
  80. BOOST_CONSTEXPR_OR_CONST DWORD_ WAIT_TIMEOUT_ = 0x00000102L;
  81. BOOST_CONSTEXPR_OR_CONST DWORD_ WAIT_FAILED_ = (DWORD_)0xFFFFFFFF;
  82. #endif // defined( BOOST_USE_WINDOWS_H )
  83. BOOST_CONSTEXPR_OR_CONST DWORD_ infinite = INFINITE_;
  84. BOOST_CONSTEXPR_OR_CONST DWORD_ wait_abandoned = WAIT_ABANDONED_;
  85. BOOST_CONSTEXPR_OR_CONST DWORD_ wait_object_0 = WAIT_OBJECT_0_;
  86. BOOST_CONSTEXPR_OR_CONST DWORD_ wait_timeout = WAIT_TIMEOUT_;
  87. BOOST_CONSTEXPR_OR_CONST DWORD_ wait_failed = WAIT_FAILED_;
  88. BOOST_CONSTEXPR_OR_CONST DWORD_ max_non_infinite_wait = (DWORD_)0xFFFFFFFE;
  89. }
  90. }
  91. #endif // BOOST_WINAPI_WAIT_HPP_INCLUDED_