null_reactor.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //
  2. // detail/null_reactor.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2018 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) || defined(BOOST_ASIO_WINDOWS_RUNTIME)
  17. #include <boost/asio/detail/scheduler_operation.hpp>
  18. #include <boost/asio/execution_context.hpp>
  19. #include <boost/asio/detail/push_options.hpp>
  20. namespace boost {
  21. namespace asio {
  22. namespace detail {
  23. class null_reactor
  24. : public execution_context_service_base<null_reactor>
  25. {
  26. public:
  27. // Constructor.
  28. null_reactor(boost::asio::execution_context& ctx)
  29. : execution_context_service_base<null_reactor>(ctx)
  30. {
  31. }
  32. // Destructor.
  33. ~null_reactor()
  34. {
  35. }
  36. // Destroy all user-defined handler objects owned by the service.
  37. void shutdown()
  38. {
  39. }
  40. // No-op because should never be called.
  41. void run(long /*usec*/, op_queue<scheduler_operation>& /*ops*/)
  42. {
  43. }
  44. // No-op.
  45. void interrupt()
  46. {
  47. }
  48. };
  49. } // namespace detail
  50. } // namespace asio
  51. } // namespace boost
  52. #include <boost/asio/detail/pop_options.hpp>
  53. #endif // defined(BOOST_ASIO_HAS_IOCP) || defined(BOOST_ASIO_WINDOWS_RUNTIME)
  54. #endif // BOOST_ASIO_DETAIL_NULL_REACTOR_HPP