File indexing completed on 2026-08-17 08:38:07
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_ASIO_DETAIL_RESOLVER_THREAD_POOL_HPP
0012 #define BOOST_ASIO_DETAIL_RESOLVER_THREAD_POOL_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/execution_context.hpp>
0020 #include <boost/asio/detail/mutex.hpp>
0021 #include <boost/asio/detail/resolve_op.hpp>
0022 #include <boost/asio/detail/scheduler.hpp>
0023 #include <boost/asio/detail/thread_group.hpp>
0024
0025 #if defined(BOOST_ASIO_HAS_IOCP)
0026 # include <boost/asio/detail/win_iocp_io_context.hpp>
0027 #else
0028 # include <boost/asio/detail/scheduler.hpp>
0029 #endif
0030
0031 #include <boost/asio/detail/push_options.hpp>
0032
0033 namespace boost {
0034 namespace asio {
0035 namespace detail {
0036
0037 class resolver_thread_pool :
0038 public execution_context_service_base<resolver_thread_pool>
0039 {
0040 public:
0041 #if defined(BOOST_ASIO_HAS_IOCP)
0042 typedef class win_iocp_io_context scheduler_impl;
0043 #else
0044 typedef class scheduler scheduler_impl;
0045 #endif
0046
0047
0048 BOOST_ASIO_DECL resolver_thread_pool(execution_context& context);
0049
0050
0051 BOOST_ASIO_DECL ~resolver_thread_pool();
0052
0053
0054 BOOST_ASIO_DECL void shutdown();
0055
0056
0057 BOOST_ASIO_DECL void notify_fork(execution_context::fork_event fork_ev);
0058
0059
0060 BOOST_ASIO_DECL void start_resolve_op(resolve_op* op);
0061
0062
0063 scheduler_impl& scheduler()
0064 {
0065 return scheduler_;
0066 }
0067
0068 private:
0069
0070 class work_scheduler_runner;
0071
0072
0073 BOOST_ASIO_DECL void start_work_threads();
0074
0075
0076 scheduler_impl& scheduler_;
0077
0078
0079 boost::asio::detail::mutex mutex_;
0080
0081
0082 scheduler_impl work_scheduler_;
0083
0084
0085 thread_group<execution_context::allocator<void>> work_threads_;
0086
0087
0088 unsigned int num_work_threads_;
0089
0090
0091 bool scheduler_locking_;
0092
0093
0094 bool shutdown_;
0095 };
0096
0097 }
0098 }
0099 }
0100
0101 #include <boost/asio/detail/pop_options.hpp>
0102
0103 #if defined(BOOST_ASIO_HEADER_ONLY)
0104 # include <boost/asio/detail/impl/resolver_thread_pool.ipp>
0105 #endif
0106
0107 #endif