2424#include < boost/asio/signal_set.hpp>
2525#include < boost/container/flat_map.hpp>
2626
27- #if BOOST_VERSION < 107000
28- # define AZMQ_DETAIL_USE_IO_SERVICE 1
29- #endif
3027
3128#include < string>
3229#include < vector>
@@ -42,12 +39,9 @@ namespace detail {
4239 public:
4340 inline static std::string get_uri (const char * pfx);
4441
45- #ifdef AZMQ_DETAIL_USE_IO_SERVICE
46- actor_service (boost::asio::io_service & ios)
47- #else
48- actor_service (boost::asio::io_context & ios)
49- #endif
50- : azmq::detail::service_base<actor_service>(ios)
42+ actor_service (boost::asio::io_context & ioc)
43+
44+ : azmq::detail::service_base<actor_service>(ioc)
5145 { }
5246
5347 void shutdown () override { }
@@ -59,21 +53,13 @@ namespace detail {
5953
6054 template <typename T>
6155 socket make_pipe (bool defer_start, T&& data) {
62- #ifdef AZMQ_DETAIL_USE_IO_SERVICE
63- return make_pipe (get_io_service (), defer_start, std::forward<T>(data));
64- #else
6556 return make_pipe (get_io_context (), defer_start, std::forward<T>(data));
66- #endif
6757 }
6858
6959 template <typename T>
70- #ifdef AZMQ_DETAIL_USE_IO_SERVICE
71- static socket make_pipe (boost::asio::io_service & ios, bool defer_start, T&& data) {
72- #else
73- static socket make_pipe (boost::asio::io_context & ios, bool defer_start, T&& data) {
74- #endif
60+ static socket make_pipe (boost::asio::io_context & ioc, bool defer_start, T&& data) {
7561 auto p = std::make_shared<model<T>>(std::forward<T>(data));
76- auto res = p->peer_socket (ios );
62+ auto res = p->peer_socket (ioc );
7763 associate_ext (res, handler (std::move (p), defer_start));
7864 return std::move (res);
7965 }
@@ -82,7 +68,7 @@ namespace detail {
8268 struct concept_ {
8369 using ptr = std::shared_ptr<concept_>;
8470
85- boost::asio::io_service io_service_ ;
71+ boost::asio::io_context io_context_ ;
8672 boost::asio::signal_set signals_;
8773 pair_socket socket_;
8874 thread_t thread_;
@@ -95,8 +81,8 @@ namespace detail {
9581 std::exception_ptr last_error_;
9682
9783 concept_ ()
98- : signals_(io_service_ , SIGINT, SIGTERM)
99- , socket_(io_service_ )
84+ : signals_(io_context_ , SIGINT, SIGTERM)
85+ , socket_(io_context_ )
10086 , ready_(false )
10187 , stopped_(true )
10288 {
@@ -105,11 +91,7 @@ namespace detail {
10591
10692 virtual ~concept_ () = default ;
10793
108- #ifdef AZMQ_DETAIL_USE_IO_SERVICE
109- pair_socket peer_socket (boost::asio::io_service & peer) {
110- #else
11194 pair_socket peer_socket (boost::asio::io_context & peer) {
112- #endif
11395 pair_socket res (peer);
11496 auto uri = socket_.endpoint ();
11597 BOOST_ASSERT_MSG (!uri.empty (), " uri empty" );
@@ -121,7 +103,7 @@ namespace detail {
121103
122104 void stop () {
123105 if (!joinable ()) return ;
124- io_service_ .stop ();
106+ io_context_ .stop ();
125107 thread_.join ();
126108 }
127109
@@ -165,7 +147,7 @@ namespace detail {
165147 static void run (ptr p) {
166148 lock_type l { p->mutex_ };
167149 p->signals_ .async_wait ([p](boost::system::error_code const &, int ) {
168- p->io_service_ .stop ();
150+ p->io_context_ .stop ();
169151 });
170152 p->stopped_ = false ;
171153 p->thread_ = thread_t ([p] {
@@ -200,7 +182,7 @@ namespace detail {
200182 , defer_start_(defer_start)
201183 { }
202184
203- void on_install (boost::asio::io_service &, void *) {
185+ void on_install (boost::asio::io_context &, void *) {
204186 if (defer_start_) return ;
205187 defer_start_ = false ;
206188 concept_::run (p_);
0 commit comments