Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

win_event.ipp 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //
  2. // detail/win_event.ipp
  3. // ~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  6. //
  7. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. #ifndef ASIO_DETAIL_IMPL_WIN_EVENT_IPP
  11. #define ASIO_DETAIL_IMPL_WIN_EVENT_IPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include "asio/detail/config.hpp"
  16. #if defined(ASIO_WINDOWS)
  17. #include "asio/detail/throw_error.hpp"
  18. #include "asio/detail/win_event.hpp"
  19. #include "asio/error.hpp"
  20. #include "asio/detail/push_options.hpp"
  21. namespace asio {
  22. namespace detail {
  23. win_event::win_event()
  24. : state_(0)
  25. {
  26. #if defined(ASIO_WINDOWS_APP)
  27. events_[0] = ::CreateEventExW(0, 0,
  28. CREATE_EVENT_MANUAL_RESET, EVENT_ALL_ACCESS);
  29. #else // defined(ASIO_WINDOWS_APP)
  30. events_[0] = ::CreateEventW(0, true, false, 0);
  31. #endif // defined(ASIO_WINDOWS_APP)
  32. if (!events_[0])
  33. {
  34. DWORD last_error = ::GetLastError();
  35. asio::error_code ec(last_error,
  36. asio::error::get_system_category());
  37. asio::detail::throw_error(ec, "event");
  38. }
  39. #if defined(ASIO_WINDOWS_APP)
  40. events_[1] = ::CreateEventExW(0, 0, 0, EVENT_ALL_ACCESS);
  41. #else // defined(ASIO_WINDOWS_APP)
  42. events_[1] = ::CreateEventW(0, false, false, 0);
  43. #endif // defined(ASIO_WINDOWS_APP)
  44. if (!events_[1])
  45. {
  46. DWORD last_error = ::GetLastError();
  47. ::CloseHandle(events_[0]);
  48. asio::error_code ec(last_error,
  49. asio::error::get_system_category());
  50. asio::detail::throw_error(ec, "event");
  51. }
  52. }
  53. win_event::~win_event()
  54. {
  55. ::CloseHandle(events_[0]);
  56. ::CloseHandle(events_[1]);
  57. }
  58. } // namespace detail
  59. } // namespace asio
  60. #include "asio/detail/pop_options.hpp"
  61. #endif // defined(ASIO_WINDOWS)
  62. #endif // ASIO_DETAIL_IMPL_WIN_EVENT_IPP