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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. //
  2. // detail/win_event.ipp
  3. // ~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2015 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, CREATE_EVENT_MANUAL_RESET, 0);
  28. #else // defined(ASIO_WINDOWS_APP)
  29. events_[0] = ::CreateEventW(0, true, false, 0);
  30. #endif // defined(ASIO_WINDOWS_APP)
  31. if (!events_[0])
  32. {
  33. DWORD last_error = ::GetLastError();
  34. asio::error_code ec(last_error,
  35. asio::error::get_system_category());
  36. asio::detail::throw_error(ec, "event");
  37. }
  38. #if defined(ASIO_WINDOWS_APP)
  39. events_[1] = ::CreateEventExW(0, 0, 0, 0);
  40. #else // defined(ASIO_WINDOWS_APP)
  41. events_[1] = ::CreateEventW(0, false, false, 0);
  42. #endif // defined(ASIO_WINDOWS_APP)
  43. if (!events_[1])
  44. {
  45. DWORD last_error = ::GetLastError();
  46. ::CloseHandle(events_[0]);
  47. asio::error_code ec(last_error,
  48. asio::error::get_system_category());
  49. asio::detail::throw_error(ec, "event");
  50. }
  51. }
  52. win_event::~win_event()
  53. {
  54. ::CloseHandle(events_[0]);
  55. ::CloseHandle(events_[1]);
  56. }
  57. } // namespace detail
  58. } // namespace asio
  59. #include "asio/detail/pop_options.hpp"
  60. #endif // defined(ASIO_WINDOWS)
  61. #endif // ASIO_DETAIL_IMPL_WIN_EVENT_IPP