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.

io_context.ipp 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. //
  2. // impl/io_context.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_IMPL_IO_CONTEXT_IPP
  11. #define ASIO_IMPL_IO_CONTEXT_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. #include "asio/io_context.hpp"
  17. #include "asio/detail/limits.hpp"
  18. #include "asio/detail/scoped_ptr.hpp"
  19. #include "asio/detail/service_registry.hpp"
  20. #include "asio/detail/throw_error.hpp"
  21. #if defined(ASIO_HAS_IOCP)
  22. # include "asio/detail/win_iocp_io_context.hpp"
  23. #else
  24. # include "asio/detail/scheduler.hpp"
  25. #endif
  26. #include "asio/detail/push_options.hpp"
  27. namespace asio {
  28. io_context::io_context()
  29. : impl_(add_impl(new impl_type(*this)))
  30. {
  31. }
  32. io_context::io_context(int concurrency_hint)
  33. : impl_(add_impl(new impl_type(*this, concurrency_hint)))
  34. {
  35. }
  36. io_context::impl_type& io_context::add_impl(io_context::impl_type* impl)
  37. {
  38. asio::detail::scoped_ptr<impl_type> scoped_impl(impl);
  39. asio::add_service<impl_type>(*this, scoped_impl.get());
  40. return *scoped_impl.release();
  41. }
  42. io_context::~io_context()
  43. {
  44. }
  45. std::size_t io_context::run()
  46. {
  47. asio::error_code ec;
  48. std::size_t s = impl_.run(ec);
  49. asio::detail::throw_error(ec);
  50. return s;
  51. }
  52. std::size_t io_context::run(asio::error_code& ec)
  53. {
  54. return impl_.run(ec);
  55. }
  56. std::size_t io_context::run_one()
  57. {
  58. asio::error_code ec;
  59. std::size_t s = impl_.run_one(ec);
  60. asio::detail::throw_error(ec);
  61. return s;
  62. }
  63. std::size_t io_context::run_one(asio::error_code& ec)
  64. {
  65. return impl_.run_one(ec);
  66. }
  67. std::size_t io_context::poll()
  68. {
  69. asio::error_code ec;
  70. std::size_t s = impl_.poll(ec);
  71. asio::detail::throw_error(ec);
  72. return s;
  73. }
  74. std::size_t io_context::poll(asio::error_code& ec)
  75. {
  76. return impl_.poll(ec);
  77. }
  78. std::size_t io_context::poll_one()
  79. {
  80. asio::error_code ec;
  81. std::size_t s = impl_.poll_one(ec);
  82. asio::detail::throw_error(ec);
  83. return s;
  84. }
  85. std::size_t io_context::poll_one(asio::error_code& ec)
  86. {
  87. return impl_.poll_one(ec);
  88. }
  89. void io_context::stop()
  90. {
  91. impl_.stop();
  92. }
  93. bool io_context::stopped() const
  94. {
  95. return impl_.stopped();
  96. }
  97. void io_context::restart()
  98. {
  99. impl_.restart();
  100. }
  101. io_context::service::service(asio::io_context& owner)
  102. : execution_context::service(owner)
  103. {
  104. }
  105. io_context::service::~service()
  106. {
  107. }
  108. void io_context::service::shutdown()
  109. {
  110. #if !defined(ASIO_NO_DEPRECATED)
  111. shutdown_service();
  112. #endif // !defined(ASIO_NO_DEPRECATED)
  113. }
  114. #if !defined(ASIO_NO_DEPRECATED)
  115. void io_context::service::shutdown_service()
  116. {
  117. }
  118. #endif // !defined(ASIO_NO_DEPRECATED)
  119. void io_context::service::notify_fork(io_context::fork_event ev)
  120. {
  121. #if !defined(ASIO_NO_DEPRECATED)
  122. fork_service(ev);
  123. #else // !defined(ASIO_NO_DEPRECATED)
  124. (void)ev;
  125. #endif // !defined(ASIO_NO_DEPRECATED)
  126. }
  127. #if !defined(ASIO_NO_DEPRECATED)
  128. void io_context::service::fork_service(io_context::fork_event)
  129. {
  130. }
  131. #endif // !defined(ASIO_NO_DEPRECATED)
  132. } // namespace asio
  133. #include "asio/detail/pop_options.hpp"
  134. #endif // ASIO_IMPL_IO_CONTEXT_IPP