Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-12 08:42:57

0001 //
0002 // impl/io_context.ipp
0003 // ~~~~~~~~~~~~~~~~~~~
0004 //
0005 // Copyright (c) 2003-2025 Christopher M. Kohlhoff (chris at kohlhoff dot com)
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009 //
0010 
0011 #ifndef BOOST_ASIO_IMPL_IO_CONTEXT_IPP
0012 #define BOOST_ASIO_IMPL_IO_CONTEXT_IPP
0013 
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
0017 
0018 #include <boost/asio/detail/config.hpp>
0019 #include <boost/asio/config.hpp>
0020 #include <boost/asio/io_context.hpp>
0021 #include <boost/asio/detail/concurrency_hint.hpp>
0022 #include <boost/asio/detail/limits.hpp>
0023 #include <boost/asio/detail/service_registry.hpp>
0024 #include <boost/asio/detail/throw_error.hpp>
0025 
0026 #if defined(BOOST_ASIO_HAS_IOCP)
0027 # include <boost/asio/detail/win_iocp_io_context.hpp>
0028 #else
0029 # include <boost/asio/detail/scheduler.hpp>
0030 #endif
0031 
0032 #include <boost/asio/detail/push_options.hpp>
0033 
0034 namespace boost {
0035 namespace asio {
0036 
0037 io_context::io_context()
0038   : execution_context(config_from_concurrency_hint()),
0039     impl_(boost::asio::make_service<impl_type>(*this, false))
0040 {
0041 }
0042 
0043 io_context::io_context(int concurrency_hint)
0044   : execution_context(config_from_concurrency_hint(concurrency_hint)),
0045     impl_(boost::asio::make_service<impl_type>(*this, false))
0046 {
0047 }
0048 
0049 io_context::io_context(const execution_context::service_maker& initial_services)
0050   : execution_context(initial_services),
0051     impl_(boost::asio::make_service<impl_type>(*this, false))
0052 {
0053 }
0054 
0055 io_context::~io_context()
0056 {
0057   shutdown();
0058 }
0059 
0060 io_context::count_type io_context::run()
0061 {
0062   boost::system::error_code ec;
0063   count_type s = impl_.run(ec);
0064   boost::asio::detail::throw_error(ec);
0065   return s;
0066 }
0067 
0068 io_context::count_type io_context::run_one()
0069 {
0070   boost::system::error_code ec;
0071   count_type s = impl_.run_one(ec);
0072   boost::asio::detail::throw_error(ec);
0073   return s;
0074 }
0075 
0076 io_context::count_type io_context::poll()
0077 {
0078   boost::system::error_code ec;
0079   count_type s = impl_.poll(ec);
0080   boost::asio::detail::throw_error(ec);
0081   return s;
0082 }
0083 
0084 io_context::count_type io_context::poll_one()
0085 {
0086   boost::system::error_code ec;
0087   count_type s = impl_.poll_one(ec);
0088   boost::asio::detail::throw_error(ec);
0089   return s;
0090 }
0091 
0092 void io_context::stop()
0093 {
0094   impl_.stop();
0095 }
0096 
0097 bool io_context::stopped() const
0098 {
0099   return impl_.stopped();
0100 }
0101 
0102 void io_context::restart()
0103 {
0104   impl_.restart();
0105 }
0106 
0107 io_context::service::service(boost::asio::io_context& owner)
0108   : execution_context::service(owner)
0109 {
0110 }
0111 
0112 io_context::service::~service()
0113 {
0114 }
0115 
0116 void io_context::service::shutdown()
0117 {
0118 }
0119 
0120 void io_context::service::notify_fork(io_context::fork_event)
0121 {
0122 }
0123 
0124 } // namespace asio
0125 } // namespace boost
0126 
0127 #include <boost/asio/detail/pop_options.hpp>
0128 
0129 #endif // BOOST_ASIO_IMPL_IO_CONTEXT_IPP