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.

60 lines
1.6KB

  1. //
  2. // detail/impl/posix_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_POSIX_EVENT_IPP
  11. #define ASIO_DETAIL_IMPL_POSIX_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_HAS_PTHREADS)
  17. #include "asio/detail/posix_event.hpp"
  18. #include "asio/detail/throw_error.hpp"
  19. #include "asio/error.hpp"
  20. #include "asio/detail/push_options.hpp"
  21. namespace asio {
  22. namespace detail {
  23. posix_event::posix_event()
  24. : state_(0)
  25. {
  26. #if (defined(__MACH__) && defined(__APPLE__)) \
  27. || (defined(__ANDROID__) && (__ANDROID_API__ < 21))
  28. int error = ::pthread_cond_init(&cond_, 0);
  29. #else // (defined(__MACH__) && defined(__APPLE__))
  30. // || (defined(__ANDROID__) && (__ANDROID_API__ < 21))
  31. ::pthread_condattr_t attr;
  32. ::pthread_condattr_init(&attr);
  33. int error = ::pthread_condattr_setclock(&attr, CLOCK_MONOTONIC);
  34. if (error == 0)
  35. error = ::pthread_cond_init(&cond_, &attr);
  36. #endif // (defined(__MACH__) && defined(__APPLE__))
  37. // || (defined(__ANDROID__) && (__ANDROID_API__ < 21))
  38. asio::error_code ec(error,
  39. asio::error::get_system_category());
  40. asio::detail::throw_error(ec, "event");
  41. }
  42. } // namespace detail
  43. } // namespace asio
  44. #include "asio/detail/pop_options.hpp"
  45. #endif // defined(ASIO_HAS_PTHREADS)
  46. #endif // ASIO_DETAIL_IMPL_POSIX_EVENT_IPP