File indexing completed on 2025-01-18 09:28:44
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_ASIO_DETAIL_RESOLVER_SERVICE_BASE_HPP
0012 #define BOOST_ASIO_DETAIL_RESOLVER_SERVICE_BASE_HPP
0013
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif
0017
0018 #include <boost/asio/detail/config.hpp>
0019 #include <boost/asio/error.hpp>
0020 #include <boost/asio/execution_context.hpp>
0021 #include <boost/asio/detail/mutex.hpp>
0022 #include <boost/asio/detail/noncopyable.hpp>
0023 #include <boost/asio/detail/resolve_op.hpp>
0024 #include <boost/asio/detail/socket_ops.hpp>
0025 #include <boost/asio/detail/socket_types.hpp>
0026 #include <boost/asio/detail/scoped_ptr.hpp>
0027 #include <boost/asio/detail/thread.hpp>
0028
0029 #if defined(BOOST_ASIO_HAS_IOCP)
0030 # include <boost/asio/detail/win_iocp_io_context.hpp>
0031 #else
0032 # include <boost/asio/detail/scheduler.hpp>
0033 #endif
0034
0035 #include <boost/asio/detail/push_options.hpp>
0036
0037 namespace boost {
0038 namespace asio {
0039 namespace detail {
0040
0041 class resolver_service_base
0042 {
0043 public:
0044
0045
0046 typedef socket_ops::shared_cancel_token_type implementation_type;
0047
0048
0049 BOOST_ASIO_DECL resolver_service_base(execution_context& context);
0050
0051
0052 BOOST_ASIO_DECL ~resolver_service_base();
0053
0054
0055 BOOST_ASIO_DECL void base_shutdown();
0056
0057
0058 BOOST_ASIO_DECL void base_notify_fork(
0059 execution_context::fork_event fork_ev);
0060
0061
0062 BOOST_ASIO_DECL void construct(implementation_type& impl);
0063
0064
0065 BOOST_ASIO_DECL void destroy(implementation_type&);
0066
0067
0068 BOOST_ASIO_DECL void move_construct(implementation_type& impl,
0069 implementation_type& other_impl);
0070
0071
0072 BOOST_ASIO_DECL void move_assign(implementation_type& impl,
0073 resolver_service_base& other_service,
0074 implementation_type& other_impl);
0075
0076
0077 void converting_move_construct(implementation_type& impl,
0078 resolver_service_base&, implementation_type& other_impl)
0079 {
0080 move_construct(impl, other_impl);
0081 }
0082
0083
0084 void converting_move_assign(implementation_type& impl,
0085 resolver_service_base& other_service,
0086 implementation_type& other_impl)
0087 {
0088 move_assign(impl, other_service, other_impl);
0089 }
0090
0091
0092 BOOST_ASIO_DECL void cancel(implementation_type& impl);
0093
0094 protected:
0095
0096 BOOST_ASIO_DECL void start_resolve_op(resolve_op* op);
0097
0098 #if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
0099
0100 class auto_addrinfo
0101 : private boost::asio::detail::noncopyable
0102 {
0103 public:
0104 explicit auto_addrinfo(boost::asio::detail::addrinfo_type* ai)
0105 : ai_(ai)
0106 {
0107 }
0108
0109 ~auto_addrinfo()
0110 {
0111 if (ai_)
0112 socket_ops::freeaddrinfo(ai_);
0113 }
0114
0115 operator boost::asio::detail::addrinfo_type*()
0116 {
0117 return ai_;
0118 }
0119
0120 private:
0121 boost::asio::detail::addrinfo_type* ai_;
0122 };
0123 #endif
0124
0125
0126 class work_scheduler_runner;
0127
0128
0129 BOOST_ASIO_DECL void start_work_thread();
0130
0131
0132 #if defined(BOOST_ASIO_HAS_IOCP)
0133 typedef class win_iocp_io_context scheduler_impl;
0134 #else
0135 typedef class scheduler scheduler_impl;
0136 #endif
0137 scheduler_impl& scheduler_;
0138
0139 private:
0140
0141 boost::asio::detail::mutex mutex_;
0142
0143
0144 boost::asio::detail::scoped_ptr<scheduler_impl> work_scheduler_;
0145
0146
0147 boost::asio::detail::scoped_ptr<boost::asio::detail::thread> work_thread_;
0148 };
0149
0150 }
0151 }
0152 }
0153
0154 #include <boost/asio/detail/pop_options.hpp>
0155
0156 #if defined(BOOST_ASIO_HEADER_ONLY)
0157 # include <boost/asio/detail/impl/resolver_service_base.ipp>
0158 #endif
0159
0160 #endif