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.7KB

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