null_reactor.hpp 1.7 KB

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