null_reactor.hpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. //
  2. // detail/null_reactor.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2024 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 BOOST_ASIO_DETAIL_NULL_REACTOR_HPP
  11. #define BOOST_ASIO_DETAIL_NULL_REACTOR_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include <boost/asio/detail/config.hpp>
  16. #if defined(BOOST_ASIO_HAS_IOCP) \
  17. || defined(BOOST_ASIO_WINDOWS_RUNTIME) \
  18. || defined(BOOST_ASIO_HAS_IO_URING_AS_DEFAULT)
  19. #include <boost/asio/detail/scheduler_operation.hpp>
  20. #include <boost/asio/detail/scheduler_task.hpp>
  21. #include <boost/asio/execution_context.hpp>
  22. #include <boost/asio/detail/push_options.hpp>
  23. namespace boost {
  24. namespace asio {
  25. namespace detail {
  26. class null_reactor
  27. : public execution_context_service_base<null_reactor>,
  28. public scheduler_task
  29. {
  30. public:
  31. struct per_descriptor_data
  32. {
  33. };
  34. // Constructor.
  35. null_reactor(boost::asio::execution_context& ctx)
  36. : execution_context_service_base<null_reactor>(ctx)
  37. {
  38. }
  39. // Destructor.
  40. ~null_reactor()
  41. {
  42. }
  43. // Initialise the task.
  44. void init_task()
  45. {
  46. }
  47. // Destroy all user-defined handler objects owned by the service.
  48. void shutdown()
  49. {
  50. }
  51. // No-op because should never be called.
  52. void run(long /*usec*/, op_queue<scheduler_operation>& /*ops*/)
  53. {
  54. }
  55. // No-op.
  56. void interrupt()
  57. {
  58. }
  59. };
  60. } // namespace detail
  61. } // namespace asio
  62. } // namespace boost
  63. #include <boost/asio/detail/pop_options.hpp>
  64. #endif // defined(BOOST_ASIO_HAS_IOCP)
  65. // || defined(BOOST_ASIO_WINDOWS_RUNTIME)
  66. // || defined(BOOST_ASIO_HAS_IO_URING_AS_DEFAULT)
  67. #endif // BOOST_ASIO_DETAIL_NULL_REACTOR_HPP