diff --git a/asio/include/Makefile.am b/asio/include/Makefile.am index 15aa7e83..e334c7cd 100644 --- a/asio/include/Makefile.am +++ b/asio/include/Makefile.am @@ -112,8 +112,8 @@ nobase_include_HEADERS = \ asio/detail/impl/timer_queue_set.ipp \ asio/detail/impl/win_event.ipp \ asio/detail/impl/win_iocp_handle_service.ipp \ - asio/detail/impl/win_iocp_io_service.hpp \ - asio/detail/impl/win_iocp_io_service.ipp \ + asio/detail/impl/win_iocp_io_context.hpp \ + asio/detail/impl/win_iocp_io_context.ipp \ asio/detail/impl/win_iocp_serial_port_service.ipp \ asio/detail/impl/win_iocp_socket_service_base.ipp \ asio/detail/impl/win_mutex.ipp \ @@ -235,7 +235,7 @@ nobase_include_HEADERS = \ asio/detail/win_iocp_handle_read_op.hpp \ asio/detail/win_iocp_handle_service.hpp \ asio/detail/win_iocp_handle_write_op.hpp \ - asio/detail/win_iocp_io_service.hpp \ + asio/detail/win_iocp_io_context.hpp \ asio/detail/win_iocp_null_buffers_op.hpp \ asio/detail/win_iocp_operation.hpp \ asio/detail/win_iocp_overlapped_op.hpp \ @@ -301,8 +301,8 @@ nobase_include_HEADERS = \ asio/impl/executor.hpp \ asio/impl/executor.ipp \ asio/impl/handler_alloc_hook.ipp \ - asio/impl/io_service.hpp \ - asio/impl/io_service.ipp \ + asio/impl/io_context.hpp \ + asio/impl/io_context.ipp \ asio/impl/post.hpp \ asio/impl/read_at.hpp \ asio/impl/read.hpp \ @@ -319,6 +319,8 @@ nobase_include_HEADERS = \ asio/impl/use_future.hpp \ asio/impl/write_at.hpp \ asio/impl/write.hpp \ + asio/io_context_strand.hpp \ + asio/io_context.hpp \ asio/io_service_strand.hpp \ asio/io_service.hpp \ asio/ip/address.hpp \ @@ -432,7 +434,7 @@ nobase_include_HEADERS = \ asio/ts/buffer.hpp \ asio/ts/executor.hpp \ asio/ts/internet.hpp \ - asio/ts/io_service.hpp \ + asio/ts/io_context.hpp \ asio/ts/networking.hpp \ asio/ts/socket.hpp \ asio/ts/thread_pool.hpp \ diff --git a/asio/include/asio.hpp b/asio/include/asio.hpp index 576fdc73..8dcf2734 100644 --- a/asio/include/asio.hpp +++ b/asio/include/asio.hpp @@ -62,6 +62,8 @@ #include "asio/handler_continuation_hook.hpp" #include "asio/handler_invoke_hook.hpp" #include "asio/handler_type.hpp" +#include "asio/io_context.hpp" +#include "asio/io_context_strand.hpp" #include "asio/io_service.hpp" #include "asio/io_service_strand.hpp" #include "asio/ip/address.hpp" diff --git a/asio/include/asio/basic_datagram_socket.hpp b/asio/include/asio/basic_datagram_socket.hpp index 350e826c..d9748eea 100644 --- a/asio/include/asio/basic_datagram_socket.hpp +++ b/asio/include/asio/basic_datagram_socket.hpp @@ -57,12 +57,12 @@ public: * This constructor creates a datagram socket without opening it. The open() * function must be called before data can be sent or received on the socket. * - * @param io_service The io_service object that the datagram socket will use + * @param io_context The io_context object that the datagram socket will use * to dispatch handlers for any asynchronous operations performed on the * socket. */ - explicit basic_datagram_socket(asio::io_service& io_service) - : basic_socket(io_service) + explicit basic_datagram_socket(asio::io_context& io_context) + : basic_socket(io_context) { } @@ -70,7 +70,7 @@ public: /** * This constructor creates and opens a datagram socket. * - * @param io_service The io_service object that the datagram socket will use + * @param io_context The io_context object that the datagram socket will use * to dispatch handlers for any asynchronous operations performed on the * socket. * @@ -78,9 +78,9 @@ public: * * @throws asio::system_error Thrown on failure. */ - basic_datagram_socket(asio::io_service& io_service, + basic_datagram_socket(asio::io_context& io_context, const protocol_type& protocol) - : basic_socket(io_service, protocol) + : basic_socket(io_context, protocol) { } @@ -91,7 +91,7 @@ public: * to the specified endpoint on the local machine. The protocol used is the * protocol associated with the given endpoint. * - * @param io_service The io_service object that the datagram socket will use + * @param io_context The io_context object that the datagram socket will use * to dispatch handlers for any asynchronous operations performed on the * socket. * @@ -100,9 +100,9 @@ public: * * @throws asio::system_error Thrown on failure. */ - basic_datagram_socket(asio::io_service& io_service, + basic_datagram_socket(asio::io_context& io_context, const endpoint_type& endpoint) - : basic_socket(io_service, endpoint) + : basic_socket(io_context, endpoint) { } @@ -111,7 +111,7 @@ public: * This constructor creates a datagram socket object to hold an existing * native socket. * - * @param io_service The io_service object that the datagram socket will use + * @param io_context The io_context object that the datagram socket will use * to dispatch handlers for any asynchronous operations performed on the * socket. * @@ -121,10 +121,10 @@ public: * * @throws asio::system_error Thrown on failure. */ - basic_datagram_socket(asio::io_service& io_service, + basic_datagram_socket(asio::io_context& io_context, const protocol_type& protocol, const native_handle_type& native_socket) : basic_socket( - io_service, protocol, native_socket) + io_context, protocol, native_socket) { } @@ -137,7 +137,7 @@ public: * will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_datagram_socket(io_service&) constructor. + * constructed using the @c basic_datagram_socket(io_context&) constructor. */ basic_datagram_socket(basic_datagram_socket&& other) : basic_socket( @@ -154,7 +154,7 @@ public: * will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_datagram_socket(io_service&) constructor. + * constructed using the @c basic_datagram_socket(io_context&) constructor. */ basic_datagram_socket& operator=(basic_datagram_socket&& other) { @@ -172,7 +172,7 @@ public: * will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_datagram_socket(io_service&) constructor. + * constructed using the @c basic_datagram_socket(io_context&) constructor. */ template basic_datagram_socket( @@ -194,7 +194,7 @@ public: * will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_datagram_socket(io_service&) constructor. + * constructed using the @c basic_datagram_socket(io_context&) constructor. */ template typename enable_if::value, @@ -313,7 +313,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note The async_send operation can only be used with a connected socket. * Use the async_send_to function to send data on an unconnected datagram @@ -364,7 +364,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note The async_send operation can only be used with a connected socket. * Use the async_send_to function to send data on an unconnected datagram @@ -496,7 +496,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * To send a single data buffer use the @ref buffer function as follows: @@ -551,7 +551,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). */ template ASIO_INITFN_RESULT_TYPE(WriteHandler, @@ -678,7 +678,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note The async_receive operation can only be used with a connected socket. * Use the async_receive_from function to receive data on an unconnected @@ -730,7 +730,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note The async_receive operation can only be used with a connected socket. * Use the async_receive_from function to receive data on an unconnected @@ -865,7 +865,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * To receive into a single data buffer use the @ref buffer function as @@ -919,7 +919,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). */ template ASIO_INITFN_RESULT_TYPE(ReadHandler, diff --git a/asio/include/asio/basic_deadline_timer.hpp b/asio/include/asio/basic_deadline_timer.hpp index 7cc13749..030053ea 100644 --- a/asio/include/asio/basic_deadline_timer.hpp +++ b/asio/include/asio/basic_deadline_timer.hpp @@ -50,7 +50,7 @@ namespace asio { * Performing a blocking wait: * @code * // Construct a timer without setting an expiry time. - * asio::deadline_timer timer(io_service); + * asio::deadline_timer timer(io_context); * * // Set an expiry time relative to now. * timer.expires_from_now(boost::posix_time::seconds(5)); @@ -73,7 +73,7 @@ namespace asio { * ... * * // Construct a timer with an absolute expiry time. - * asio::deadline_timer timer(io_service, + * asio::deadline_timer timer(io_context, * boost::posix_time::time_from_string("2005-12-07 23:59:59.000")); * * // Start an asynchronous wait. @@ -141,11 +141,11 @@ public: * expires_at() or expires_from_now() functions must be called to set an * expiry time before the timer can be waited on. * - * @param io_service The io_service object that the timer will use to dispatch + * @param io_context The io_context object that the timer will use to dispatch * handlers for any asynchronous operations performed on the timer. */ - explicit basic_deadline_timer(asio::io_service& io_service) - : basic_io_object(io_service) + explicit basic_deadline_timer(asio::io_context& io_context) + : basic_io_object(io_context) { } @@ -153,15 +153,15 @@ public: /** * This constructor creates a timer and sets the expiry time. * - * @param io_service The io_service object that the timer will use to dispatch + * @param io_context The io_context object that the timer will use to dispatch * handlers for any asynchronous operations performed on the timer. * * @param expiry_time The expiry time to be used for the timer, expressed * as an absolute time. */ - basic_deadline_timer(asio::io_service& io_service, + basic_deadline_timer(asio::io_context& io_context, const time_type& expiry_time) - : basic_io_object(io_service) + : basic_io_object(io_context) { asio::error_code ec; this->get_service().expires_at(this->get_implementation(), expiry_time, ec); @@ -172,15 +172,15 @@ public: /** * This constructor creates a timer and sets the expiry time. * - * @param io_service The io_service object that the timer will use to dispatch + * @param io_context The io_context object that the timer will use to dispatch * handlers for any asynchronous operations performed on the timer. * * @param expiry_time The expiry time to be used for the timer, relative to * now. */ - basic_deadline_timer(asio::io_service& io_service, + basic_deadline_timer(asio::io_context& io_context, const duration_type& expiry_time) - : basic_io_object(io_service) + : basic_io_object(io_context) { asio::error_code ec; this->get_service().expires_from_now( @@ -495,7 +495,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). */ template ASIO_INITFN_RESULT_TYPE(WaitHandler, diff --git a/asio/include/asio/basic_io_object.hpp b/asio/include/asio/basic_io_object.hpp index 934f581f..40cf8963 100644 --- a/asio/include/asio/basic_io_object.hpp +++ b/asio/include/asio/basic_io_object.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/detail/push_options.hpp" @@ -67,28 +67,42 @@ public: typedef typename service_type::implementation_type implementation_type; #if !defined(ASIO_NO_DEPRECATED) - /// (Deprecated: Use get_executor().) Get the io_service associated with the + /// (Deprecated: Use get_executor().) Get the io_context associated with the /// object. /** - * This function may be used to obtain the io_service object that the I/O + * This function may be used to obtain the io_context object that the I/O * object uses to dispatch handlers for asynchronous operations. * - * @return A reference to the io_service object that the I/O object will use + * @return A reference to the io_context object that the I/O object will use * to dispatch handlers. Ownership is not transferred to the caller. */ - asio::io_service& get_io_service() + asio::io_context& get_io_context() { - return service_.get_io_service(); + return service_.get_io_context(); + } + + /// (Deprecated: Use get_executor().) Get the io_context associated with the + /// object. + /** + * This function may be used to obtain the io_context object that the I/O + * object uses to dispatch handlers for asynchronous operations. + * + * @return A reference to the io_context object that the I/O object will use + * to dispatch handlers. Ownership is not transferred to the caller. + */ + asio::io_context& get_io_service() + { + return service_.get_io_context(); } #endif // !defined(ASIO_NO_DEPRECATED) /// The type of the executor associated with the object. - typedef asio::io_service::executor_type executor_type; + typedef asio::io_context::executor_type executor_type; /// Get the executor associated with the object. executor_type get_executor() ASIO_NOEXCEPT { - return service_.get_io_service().get_executor(); + return service_.get_io_context().get_executor(); } protected: @@ -97,8 +111,8 @@ protected: * Performs: * @code get_service().construct(get_implementation()); @endcode */ - explicit basic_io_object(asio::io_service& io_service) - : service_(asio::use_service(io_service)) + explicit basic_io_object(asio::io_context& io_context) + : service_(asio::use_service(io_context)) { service_.construct(implementation_); } @@ -180,22 +194,27 @@ public: typedef typename service_type::implementation_type implementation_type; #if !defined(ASIO_NO_DEPRECATED) - asio::io_service& get_io_service() + asio::io_context& get_io_context() { - return service_->get_io_service(); + return service_->get_io_context(); + } + + asio::io_context& get_io_service() + { + return service_->get_io_context(); } #endif // !defined(ASIO_NO_DEPRECATED) - typedef asio::io_service::executor_type executor_type; + typedef asio::io_context::executor_type executor_type; executor_type get_executor() ASIO_NOEXCEPT { - return service_->get_io_service().get_executor(); + return service_->get_io_context().get_executor(); } protected: - explicit basic_io_object(asio::io_service& io_service) - : service_(&asio::use_service(io_service)) + explicit basic_io_object(asio::io_context& io_context) + : service_(&asio::use_service(io_context)) { service_->construct(implementation_); } diff --git a/asio/include/asio/basic_raw_socket.hpp b/asio/include/asio/basic_raw_socket.hpp index 33031c0c..3ca392b7 100644 --- a/asio/include/asio/basic_raw_socket.hpp +++ b/asio/include/asio/basic_raw_socket.hpp @@ -57,12 +57,12 @@ public: * This constructor creates a raw socket without opening it. The open() * function must be called before data can be sent or received on the socket. * - * @param io_service The io_service object that the raw socket will use + * @param io_context The io_context object that the raw socket will use * to dispatch handlers for any asynchronous operations performed on the * socket. */ - explicit basic_raw_socket(asio::io_service& io_service) - : basic_socket(io_service) + explicit basic_raw_socket(asio::io_context& io_context) + : basic_socket(io_context) { } @@ -70,7 +70,7 @@ public: /** * This constructor creates and opens a raw socket. * - * @param io_service The io_service object that the raw socket will use + * @param io_context The io_context object that the raw socket will use * to dispatch handlers for any asynchronous operations performed on the * socket. * @@ -78,9 +78,9 @@ public: * * @throws asio::system_error Thrown on failure. */ - basic_raw_socket(asio::io_service& io_service, + basic_raw_socket(asio::io_context& io_context, const protocol_type& protocol) - : basic_socket(io_service, protocol) + : basic_socket(io_context, protocol) { } @@ -91,7 +91,7 @@ public: * to the specified endpoint on the local machine. The protocol used is the * protocol associated with the given endpoint. * - * @param io_service The io_service object that the raw socket will use + * @param io_context The io_context object that the raw socket will use * to dispatch handlers for any asynchronous operations performed on the * socket. * @@ -100,9 +100,9 @@ public: * * @throws asio::system_error Thrown on failure. */ - basic_raw_socket(asio::io_service& io_service, + basic_raw_socket(asio::io_context& io_context, const endpoint_type& endpoint) - : basic_socket(io_service, endpoint) + : basic_socket(io_context, endpoint) { } @@ -111,7 +111,7 @@ public: * This constructor creates a raw socket object to hold an existing * native socket. * - * @param io_service The io_service object that the raw socket will use + * @param io_context The io_context object that the raw socket will use * to dispatch handlers for any asynchronous operations performed on the * socket. * @@ -121,10 +121,10 @@ public: * * @throws asio::system_error Thrown on failure. */ - basic_raw_socket(asio::io_service& io_service, + basic_raw_socket(asio::io_context& io_context, const protocol_type& protocol, const native_handle_type& native_socket) : basic_socket( - io_service, protocol, native_socket) + io_context, protocol, native_socket) { } @@ -137,7 +137,7 @@ public: * will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_raw_socket(io_service&) constructor. + * constructed using the @c basic_raw_socket(io_context&) constructor. */ basic_raw_socket(basic_raw_socket&& other) : basic_socket( @@ -153,7 +153,7 @@ public: * will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_raw_socket(io_service&) constructor. + * constructed using the @c basic_raw_socket(io_context&) constructor. */ basic_raw_socket& operator=(basic_raw_socket&& other) { @@ -170,7 +170,7 @@ public: * occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_raw_socket(io_service&) constructor. + * constructed using the @c basic_raw_socket(io_context&) constructor. */ template basic_raw_socket(basic_raw_socket&& other, @@ -189,7 +189,7 @@ public: * will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_raw_socket(io_service&) constructor. + * constructed using the @c basic_raw_socket(io_context&) constructor. */ template typename enable_if::value, @@ -305,7 +305,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note The async_send operation can only be used with a connected socket. * Use the async_send_to function to send data on an unconnected raw @@ -356,7 +356,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note The async_send operation can only be used with a connected socket. * Use the async_send_to function to send data on an unconnected raw @@ -488,7 +488,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * To send a single data buffer use the @ref buffer function as follows: @@ -542,7 +542,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). */ template ASIO_INITFN_RESULT_TYPE(WriteHandler, @@ -669,7 +669,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note The async_receive operation can only be used with a connected socket. * Use the async_receive_from function to receive data on an unconnected @@ -721,7 +721,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note The async_receive operation can only be used with a connected socket. * Use the async_receive_from function to receive data on an unconnected @@ -856,7 +856,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * To receive into a single data buffer use the @ref buffer function as @@ -910,7 +910,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). */ template ASIO_INITFN_RESULT_TYPE(ReadHandler, diff --git a/asio/include/asio/basic_seq_packet_socket.hpp b/asio/include/asio/basic_seq_packet_socket.hpp index a05716f9..2271ceaf 100644 --- a/asio/include/asio/basic_seq_packet_socket.hpp +++ b/asio/include/asio/basic_seq_packet_socket.hpp @@ -58,12 +58,12 @@ public: * socket needs to be opened and then connected or accepted before data can * be sent or received on it. * - * @param io_service The io_service object that the sequenced packet socket + * @param io_context The io_context object that the sequenced packet socket * will use to dispatch handlers for any asynchronous operations performed on * the socket. */ - explicit basic_seq_packet_socket(asio::io_service& io_service) - : basic_socket(io_service) + explicit basic_seq_packet_socket(asio::io_context& io_context) + : basic_socket(io_context) { } @@ -73,7 +73,7 @@ public: * needs to be connected or accepted before data can be sent or received on * it. * - * @param io_service The io_service object that the sequenced packet socket + * @param io_context The io_context object that the sequenced packet socket * will use to dispatch handlers for any asynchronous operations performed on * the socket. * @@ -81,9 +81,9 @@ public: * * @throws asio::system_error Thrown on failure. */ - basic_seq_packet_socket(asio::io_service& io_service, + basic_seq_packet_socket(asio::io_context& io_context, const protocol_type& protocol) - : basic_socket(io_service, protocol) + : basic_socket(io_context, protocol) { } @@ -94,7 +94,7 @@ public: * it bound to the specified endpoint on the local machine. The protocol used * is the protocol associated with the given endpoint. * - * @param io_service The io_service object that the sequenced packet socket + * @param io_context The io_context object that the sequenced packet socket * will use to dispatch handlers for any asynchronous operations performed on * the socket. * @@ -103,9 +103,9 @@ public: * * @throws asio::system_error Thrown on failure. */ - basic_seq_packet_socket(asio::io_service& io_service, + basic_seq_packet_socket(asio::io_context& io_context, const endpoint_type& endpoint) - : basic_socket(io_service, endpoint) + : basic_socket(io_context, endpoint) { } @@ -114,7 +114,7 @@ public: * This constructor creates a sequenced packet socket object to hold an * existing native socket. * - * @param io_service The io_service object that the sequenced packet socket + * @param io_context The io_context object that the sequenced packet socket * will use to dispatch handlers for any asynchronous operations performed on * the socket. * @@ -124,10 +124,10 @@ public: * * @throws asio::system_error Thrown on failure. */ - basic_seq_packet_socket(asio::io_service& io_service, + basic_seq_packet_socket(asio::io_context& io_context, const protocol_type& protocol, const native_handle_type& native_socket) : basic_socket( - io_service, protocol, native_socket) + io_context, protocol, native_socket) { } @@ -141,7 +141,7 @@ public: * will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_seq_packet_socket(io_service&) constructor. + * constructed using the @c basic_seq_packet_socket(io_context&) constructor. */ basic_seq_packet_socket(basic_seq_packet_socket&& other) : basic_socket( @@ -158,7 +158,7 @@ public: * will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_seq_packet_socket(io_service&) constructor. + * constructed using the @c basic_seq_packet_socket(io_context&) constructor. */ basic_seq_packet_socket& operator=(basic_seq_packet_socket&& other) { @@ -177,7 +177,7 @@ public: * will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_seq_packet_socket(io_service&) constructor. + * constructed using the @c basic_seq_packet_socket(io_context&) constructor. */ template basic_seq_packet_socket( @@ -199,7 +199,7 @@ public: * will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_seq_packet_socket(io_service&) constructor. + * constructed using the @c basic_seq_packet_socket(io_context&) constructor. */ template typename enable_if::value, @@ -295,7 +295,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * To send a single data buffer use the @ref buffer function as follows: @@ -466,7 +466,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * To receive into a single data buffer use the @ref buffer function as @@ -522,7 +522,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * To receive into a single data buffer use the @ref buffer function as diff --git a/asio/include/asio/basic_serial_port.hpp b/asio/include/asio/basic_serial_port.hpp index 0f143252..e4721177 100644 --- a/asio/include/asio/basic_serial_port.hpp +++ b/asio/include/asio/basic_serial_port.hpp @@ -58,11 +58,11 @@ public: /** * This constructor creates a serial port without opening it. * - * @param io_service The io_service object that the serial port will use to + * @param io_context The io_context object that the serial port will use to * dispatch handlers for any asynchronous operations performed on the port. */ - explicit basic_serial_port(asio::io_service& io_service) - : basic_io_object(io_service) + explicit basic_serial_port(asio::io_context& io_context) + : basic_io_object(io_context) { } @@ -71,15 +71,15 @@ public: * This constructor creates and opens a serial port for the specified device * name. * - * @param io_service The io_service object that the serial port will use to + * @param io_context The io_context object that the serial port will use to * dispatch handlers for any asynchronous operations performed on the port. * * @param device The platform-specific device name for this serial * port. */ - explicit basic_serial_port(asio::io_service& io_service, + explicit basic_serial_port(asio::io_context& io_context, const char* device) - : basic_io_object(io_service) + : basic_io_object(io_context) { asio::error_code ec; this->get_service().open(this->get_implementation(), device, ec); @@ -91,15 +91,15 @@ public: * This constructor creates and opens a serial port for the specified device * name. * - * @param io_service The io_service object that the serial port will use to + * @param io_context The io_context object that the serial port will use to * dispatch handlers for any asynchronous operations performed on the port. * * @param device The platform-specific device name for this serial * port. */ - explicit basic_serial_port(asio::io_service& io_service, + explicit basic_serial_port(asio::io_context& io_context, const std::string& device) - : basic_io_object(io_service) + : basic_io_object(io_context) { asio::error_code ec; this->get_service().open(this->get_implementation(), device, ec); @@ -111,16 +111,16 @@ public: * This constructor creates a serial port object to hold an existing native * serial port. * - * @param io_service The io_service object that the serial port will use to + * @param io_context The io_context object that the serial port will use to * dispatch handlers for any asynchronous operations performed on the port. * * @param native_serial_port A native serial port. * * @throws asio::system_error Thrown on failure. */ - basic_serial_port(asio::io_service& io_service, + basic_serial_port(asio::io_context& io_context, const native_handle_type& native_serial_port) - : basic_io_object(io_service) + : basic_io_object(io_context) { asio::error_code ec; this->get_service().assign(this->get_implementation(), @@ -137,7 +137,7 @@ public: * occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_serial_port(io_service&) constructor. + * constructed using the @c basic_serial_port(io_context&) constructor. */ basic_serial_port(basic_serial_port&& other) : basic_io_object( @@ -153,7 +153,7 @@ public: * occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_serial_port(io_service&) constructor. + * constructed using the @c basic_serial_port(io_context&) constructor. */ basic_serial_port& operator=(basic_serial_port&& other) { @@ -526,7 +526,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note The write operation may not transmit all of the data to the peer. * Consider using the @ref async_write function if you need to ensure that all @@ -638,7 +638,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note The read operation may not read all of the requested number of bytes. * Consider using the @ref async_read function if you need to ensure that the diff --git a/asio/include/asio/basic_signal_set.hpp b/asio/include/asio/basic_signal_set.hpp index 117b25f5..642d10a0 100644 --- a/asio/include/asio/basic_signal_set.hpp +++ b/asio/include/asio/basic_signal_set.hpp @@ -54,7 +54,7 @@ namespace asio { * ... * * // Construct a signal set registered for process termination. - * asio::signal_set signals(io_service, SIGINT, SIGTERM); + * asio::signal_set signals(io_context, SIGINT, SIGTERM); * * // Start an asynchronous wait for one of the signals to occur. * signals.async_wait(handler); @@ -98,11 +98,11 @@ public: /** * This constructor creates a signal set without registering for any signals. * - * @param io_service The io_service object that the signal set will use to + * @param io_context The io_context object that the signal set will use to * dispatch handlers for any asynchronous operations performed on the set. */ - explicit basic_signal_set(asio::io_service& io_service) - : basic_io_object(io_service) + explicit basic_signal_set(asio::io_context& io_context) + : basic_io_object(io_context) { } @@ -110,17 +110,17 @@ public: /** * This constructor creates a signal set and registers for one signal. * - * @param io_service The io_service object that the signal set will use to + * @param io_context The io_context object that the signal set will use to * dispatch handlers for any asynchronous operations performed on the set. * * @param signal_number_1 The signal number to be added. * * @note This constructor is equivalent to performing: - * @code asio::signal_set signals(io_service); + * @code asio::signal_set signals(io_context); * signals.add(signal_number_1); @endcode */ - basic_signal_set(asio::io_service& io_service, int signal_number_1) - : basic_io_object(io_service) + basic_signal_set(asio::io_context& io_context, int signal_number_1) + : basic_io_object(io_context) { asio::error_code ec; this->get_service().add(this->get_implementation(), signal_number_1, ec); @@ -131,7 +131,7 @@ public: /** * This constructor creates a signal set and registers for two signals. * - * @param io_service The io_service object that the signal set will use to + * @param io_context The io_context object that the signal set will use to * dispatch handlers for any asynchronous operations performed on the set. * * @param signal_number_1 The first signal number to be added. @@ -139,13 +139,13 @@ public: * @param signal_number_2 The second signal number to be added. * * @note This constructor is equivalent to performing: - * @code asio::signal_set signals(io_service); + * @code asio::signal_set signals(io_context); * signals.add(signal_number_1); * signals.add(signal_number_2); @endcode */ - basic_signal_set(asio::io_service& io_service, int signal_number_1, + basic_signal_set(asio::io_context& io_context, int signal_number_1, int signal_number_2) - : basic_io_object(io_service) + : basic_io_object(io_context) { asio::error_code ec; this->get_service().add(this->get_implementation(), signal_number_1, ec); @@ -158,7 +158,7 @@ public: /** * This constructor creates a signal set and registers for three signals. * - * @param io_service The io_service object that the signal set will use to + * @param io_context The io_context object that the signal set will use to * dispatch handlers for any asynchronous operations performed on the set. * * @param signal_number_1 The first signal number to be added. @@ -168,14 +168,14 @@ public: * @param signal_number_3 The third signal number to be added. * * @note This constructor is equivalent to performing: - * @code asio::signal_set signals(io_service); + * @code asio::signal_set signals(io_context); * signals.add(signal_number_1); * signals.add(signal_number_2); * signals.add(signal_number_3); @endcode */ - basic_signal_set(asio::io_service& io_service, int signal_number_1, + basic_signal_set(asio::io_context& io_context, int signal_number_1, int signal_number_2, int signal_number_3) - : basic_io_object(io_service) + : basic_io_object(io_context) { asio::error_code ec; this->get_service().add(this->get_implementation(), signal_number_1, ec); @@ -363,7 +363,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). */ template ASIO_INITFN_RESULT_TYPE(SignalHandler, diff --git a/asio/include/asio/basic_socket.hpp b/asio/include/asio/basic_socket.hpp index 8ff13dec..582982a9 100644 --- a/asio/include/asio/basic_socket.hpp +++ b/asio/include/asio/basic_socket.hpp @@ -60,11 +60,11 @@ public: /** * This constructor creates a socket without opening it. * - * @param io_service The io_service object that the socket will use to + * @param io_context The io_context object that the socket will use to * dispatch handlers for any asynchronous operations performed on the socket. */ - explicit basic_socket(asio::io_service& io_service) - : basic_io_object(io_service) + explicit basic_socket(asio::io_context& io_context) + : basic_io_object(io_context) { } @@ -72,16 +72,16 @@ public: /** * This constructor creates and opens a socket. * - * @param io_service The io_service object that the socket will use to + * @param io_context The io_context object that the socket will use to * dispatch handlers for any asynchronous operations performed on the socket. * * @param protocol An object specifying protocol parameters to be used. * * @throws asio::system_error Thrown on failure. */ - basic_socket(asio::io_service& io_service, + basic_socket(asio::io_context& io_context, const protocol_type& protocol) - : basic_io_object(io_service) + : basic_io_object(io_context) { asio::error_code ec; this->get_service().open(this->get_implementation(), protocol, ec); @@ -95,7 +95,7 @@ public: * specified endpoint on the local machine. The protocol used is the protocol * associated with the given endpoint. * - * @param io_service The io_service object that the socket will use to + * @param io_context The io_context object that the socket will use to * dispatch handlers for any asynchronous operations performed on the socket. * * @param endpoint An endpoint on the local machine to which the socket will @@ -103,9 +103,9 @@ public: * * @throws asio::system_error Thrown on failure. */ - basic_socket(asio::io_service& io_service, + basic_socket(asio::io_context& io_context, const endpoint_type& endpoint) - : basic_io_object(io_service) + : basic_io_object(io_context) { asio::error_code ec; const protocol_type protocol = endpoint.protocol(); @@ -119,7 +119,7 @@ public: /** * This constructor creates a socket object to hold an existing native socket. * - * @param io_service The io_service object that the socket will use to + * @param io_context The io_context object that the socket will use to * dispatch handlers for any asynchronous operations performed on the socket. * * @param protocol An object specifying protocol parameters to be used. @@ -128,9 +128,9 @@ public: * * @throws asio::system_error Thrown on failure. */ - basic_socket(asio::io_service& io_service, + basic_socket(asio::io_context& io_context, const protocol_type& protocol, const native_handle_type& native_socket) - : basic_io_object(io_service) + : basic_io_object(io_context) { asio::error_code ec; this->get_service().assign(this->get_implementation(), @@ -147,7 +147,7 @@ public: * occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_socket(io_service&) constructor. + * constructed using the @c basic_socket(io_context&) constructor. */ basic_socket(basic_socket&& other) : basic_io_object( @@ -163,7 +163,7 @@ public: * occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_socket(io_service&) constructor. + * constructed using the @c basic_socket(io_context&) constructor. */ basic_socket& operator=(basic_socket&& other) { @@ -184,12 +184,12 @@ public: * occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_socket(io_service&) constructor. + * constructed using the @c basic_socket(io_context&) constructor. */ template basic_socket(basic_socket&& other, typename enable_if::value>::type* = 0) - : basic_io_object(other.get_service().get_io_service()) + : basic_io_object(other.get_service().get_io_context()) { this->get_service().template converting_move_construct( this->get_implementation(), other.get_implementation()); @@ -203,7 +203,7 @@ public: * occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_socket(io_service&) constructor. + * constructed using the @c basic_socket(io_context&) constructor. */ template typename enable_if::value, @@ -256,7 +256,7 @@ public: * * @par Example * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * socket.open(asio::ip::tcp::v4()); * @endcode */ @@ -277,7 +277,7 @@ public: * * @par Example * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * asio::error_code ec; * socket.open(asio::ip::tcp::v4(), ec); * if (ec) @@ -364,7 +364,7 @@ public: * * @par Example * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::error_code ec; * socket.close(ec); @@ -566,7 +566,7 @@ public: * * @par Example * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * socket.open(asio::ip::tcp::v4()); * socket.bind(asio::ip::tcp::endpoint( * asio::ip::tcp::v4(), 12345)); @@ -591,7 +591,7 @@ public: * * @par Example * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * socket.open(asio::ip::tcp::v4()); * asio::error_code ec; * socket.bind(asio::ip::tcp::endpoint( @@ -625,7 +625,7 @@ public: * * @par Example * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * asio::ip::tcp::endpoint endpoint( * asio::ip::address::from_string("1.2.3.4"), 12345); * socket.connect(endpoint); @@ -661,7 +661,7 @@ public: * * @par Example * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * asio::ip::tcp::endpoint endpoint( * asio::ip::address::from_string("1.2.3.4"), 12345); * asio::error_code ec; @@ -709,7 +709,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * @code @@ -723,7 +723,7 @@ public: * * ... * - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * asio::ip::tcp::endpoint endpoint( * asio::ip::address::from_string("1.2.3.4"), 12345); * socket.async_connect(endpoint, connect_handler); @@ -790,7 +790,7 @@ public: * @par Example * Setting the IPPROTO_TCP/TCP_NODELAY option: * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::ip::tcp::no_delay option(true); * socket.set_option(option); @@ -832,7 +832,7 @@ public: * @par Example * Setting the IPPROTO_TCP/TCP_NODELAY option: * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::ip::tcp::no_delay option(true); * asio::error_code ec; @@ -879,7 +879,7 @@ public: * @par Example * Getting the value of the SOL_SOCKET/SO_KEEPALIVE option: * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::ip::tcp::socket::keep_alive option; * socket.get_option(option); @@ -922,7 +922,7 @@ public: * @par Example * Getting the value of the SOL_SOCKET/SO_KEEPALIVE option: * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::ip::tcp::socket::keep_alive option; * asio::error_code ec; @@ -957,7 +957,7 @@ public: * @par Example * Getting the number of bytes ready to read: * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::ip::tcp::socket::bytes_readable command; * socket.io_control(command); @@ -987,7 +987,7 @@ public: * @par Example * Getting the number of bytes ready to read: * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::ip::tcp::socket::bytes_readable command; * asio::error_code ec; @@ -1347,7 +1347,7 @@ public: * * @par Example * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::ip::tcp::endpoint endpoint = socket.local_endpoint(); * @endcode @@ -1372,7 +1372,7 @@ public: * * @par Example * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::error_code ec; * asio::ip::tcp::endpoint endpoint = socket.local_endpoint(ec); @@ -1397,7 +1397,7 @@ public: * * @par Example * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(); * @endcode @@ -1422,7 +1422,7 @@ public: * * @par Example * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::error_code ec; * asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec); @@ -1449,7 +1449,7 @@ public: * @par Example * Shutting down the send side of the socket: * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * socket.shutdown(asio::ip::tcp::socket::shutdown_send); * @endcode @@ -1473,7 +1473,7 @@ public: * @par Example * Shutting down the send side of the socket: * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::error_code ec; * socket.shutdown(asio::ip::tcp::socket::shutdown_send, ec); @@ -1500,7 +1500,7 @@ public: * @par Example * Waiting for a socket to become readable. * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * socket.wait(asio::ip::tcp::socket::wait_read); * @endcode @@ -1525,7 +1525,7 @@ public: * @par Example * Waiting for a socket to become readable. * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::error_code ec; * socket.wait(asio::ip::tcp::socket::wait_read, ec); @@ -1553,7 +1553,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * @code @@ -1567,7 +1567,7 @@ public: * * ... * - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * socket.async_wait(asio::ip::tcp::socket::wait_read, wait_handler); * @endcode diff --git a/asio/include/asio/basic_socket_acceptor.hpp b/asio/include/asio/basic_socket_acceptor.hpp index 17e6c34f..92d2c4b0 100644 --- a/asio/include/asio/basic_socket_acceptor.hpp +++ b/asio/include/asio/basic_socket_acceptor.hpp @@ -41,7 +41,7 @@ namespace asio { * @par Example * Opening a socket acceptor with the SO_REUSEADDR option enabled: * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * asio::ip::tcp::endpoint endpoint(asio::ip::tcp::v4(), port); * acceptor.open(endpoint.protocol()); * acceptor.set_option(asio::ip::tcp::acceptor::reuse_address(true)); @@ -71,12 +71,12 @@ public: * connections. The open() function must be called before the acceptor can * accept new socket connections. * - * @param io_service The io_service object that the acceptor will use to + * @param io_context The io_context object that the acceptor will use to * dispatch handlers for any asynchronous operations performed on the * acceptor. */ - explicit basic_socket_acceptor(asio::io_service& io_service) - : basic_io_object(io_service) + explicit basic_socket_acceptor(asio::io_context& io_context) + : basic_io_object(io_context) { } @@ -84,7 +84,7 @@ public: /** * This constructor creates an acceptor and automatically opens it. * - * @param io_service The io_service object that the acceptor will use to + * @param io_context The io_context object that the acceptor will use to * dispatch handlers for any asynchronous operations performed on the * acceptor. * @@ -92,9 +92,9 @@ public: * * @throws asio::system_error Thrown on failure. */ - basic_socket_acceptor(asio::io_service& io_service, + basic_socket_acceptor(asio::io_context& io_context, const protocol_type& protocol) - : basic_io_object(io_service) + : basic_io_object(io_context) { asio::error_code ec; this->get_service().open(this->get_implementation(), protocol, ec); @@ -106,7 +106,7 @@ public: * This constructor creates an acceptor and automatically opens it to listen * for new connections on the specified endpoint. * - * @param io_service The io_service object that the acceptor will use to + * @param io_context The io_context object that the acceptor will use to * dispatch handlers for any asynchronous operations performed on the * acceptor. * @@ -120,7 +120,7 @@ public: * * @note This constructor is equivalent to the following code: * @code - * basic_socket_acceptor acceptor(io_service); + * basic_socket_acceptor acceptor(io_context); * acceptor.open(endpoint.protocol()); * if (reuse_addr) * acceptor.set_option(socket_base::reuse_address(true)); @@ -128,9 +128,9 @@ public: * acceptor.listen(listen_backlog); * @endcode */ - basic_socket_acceptor(asio::io_service& io_service, + basic_socket_acceptor(asio::io_context& io_context, const endpoint_type& endpoint, bool reuse_addr = true) - : basic_io_object(io_service) + : basic_io_object(io_context) { asio::error_code ec; const protocol_type protocol = endpoint.protocol(); @@ -154,7 +154,7 @@ public: * This constructor creates an acceptor object to hold an existing native * acceptor. * - * @param io_service The io_service object that the acceptor will use to + * @param io_context The io_context object that the acceptor will use to * dispatch handlers for any asynchronous operations performed on the * acceptor. * @@ -164,9 +164,9 @@ public: * * @throws asio::system_error Thrown on failure. */ - basic_socket_acceptor(asio::io_service& io_service, + basic_socket_acceptor(asio::io_context& io_context, const protocol_type& protocol, const native_handle_type& native_acceptor) - : basic_io_object(io_service) + : basic_io_object(io_context) { asio::error_code ec; this->get_service().assign(this->get_implementation(), @@ -183,7 +183,7 @@ public: * will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_socket_acceptor(io_service&) constructor. + * constructed using the @c basic_socket_acceptor(io_context&) constructor. */ basic_socket_acceptor(basic_socket_acceptor&& other) : basic_io_object( @@ -199,7 +199,7 @@ public: * will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_socket_acceptor(io_service&) constructor. + * constructed using the @c basic_socket_acceptor(io_context&) constructor. */ basic_socket_acceptor& operator=(basic_socket_acceptor&& other) { @@ -221,14 +221,14 @@ public: * will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_socket(io_service&) constructor. + * constructed using the @c basic_socket(io_context&) constructor. */ template basic_socket_acceptor( basic_socket_acceptor&& other, typename enable_if::value>::type* = 0) : basic_io_object( - other.get_service().get_io_service()) + other.get_service().get_io_context()) { this->get_service().template converting_move_construct( this->get_implementation(), other.get_implementation()); @@ -243,7 +243,7 @@ public: * will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_socket(io_service&) constructor. + * constructed using the @c basic_socket(io_context&) constructor. */ template typename enable_if::value, @@ -269,7 +269,7 @@ public: * * @par Example * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * acceptor.open(asio::ip::tcp::v4()); * @endcode */ @@ -291,7 +291,7 @@ public: * * @par Example * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * asio::error_code ec; * acceptor.open(asio::ip::tcp::v4(), ec); * if (ec) @@ -360,7 +360,7 @@ public: * * @par Example * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * asio::ip::tcp::endpoint endpoint(asio::ip::tcp::v4(), 12345); * acceptor.open(endpoint.protocol()); * acceptor.bind(endpoint); @@ -385,7 +385,7 @@ public: * * @par Example * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * asio::ip::tcp::endpoint endpoint(asio::ip::tcp::v4(), 12345); * acceptor.open(endpoint.protocol()); * asio::error_code ec; @@ -431,7 +431,7 @@ public: * * @par Example * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * asio::error_code ec; * acceptor.listen(asio::socket_base::max_connections, ec); @@ -475,7 +475,7 @@ public: * * @par Example * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * asio::error_code ec; * acceptor.close(ec); @@ -544,7 +544,7 @@ public: * @par Example * Setting the SOL_SOCKET/SO_REUSEADDR option: * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * asio::ip::tcp::acceptor::reuse_address option(true); * acceptor.set_option(option); @@ -573,7 +573,7 @@ public: * @par Example * Setting the SOL_SOCKET/SO_REUSEADDR option: * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * asio::ip::tcp::acceptor::reuse_address option(true); * asio::error_code ec; @@ -607,7 +607,7 @@ public: * @par Example * Getting the value of the SOL_SOCKET/SO_REUSEADDR option: * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * asio::ip::tcp::acceptor::reuse_address option; * acceptor.get_option(option); @@ -637,7 +637,7 @@ public: * @par Example * Getting the value of the SOL_SOCKET/SO_REUSEADDR option: * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * asio::ip::tcp::acceptor::reuse_address option; * asio::error_code ec; @@ -671,7 +671,7 @@ public: * @par Example * Getting the number of bytes ready to read: * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * asio::ip::tcp::acceptor::non_blocking_io command(true); * socket.io_control(command); @@ -699,7 +699,7 @@ public: * @par Example * Getting the number of bytes ready to read: * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * asio::ip::tcp::acceptor::non_blocking_io command(true); * asio::error_code ec; @@ -848,7 +848,7 @@ public: * * @par Example * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * asio::ip::tcp::endpoint endpoint = acceptor.local_endpoint(); * @endcode @@ -874,7 +874,7 @@ public: * * @par Example * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * asio::error_code ec; * asio::ip::tcp::endpoint endpoint = acceptor.local_endpoint(ec); @@ -900,7 +900,7 @@ public: * @par Example * Waiting for an acceptor to become readable. * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * acceptor.wait(asio::ip::tcp::acceptor::wait_read); * @endcode @@ -925,7 +925,7 @@ public: * @par Example * Waiting for an acceptor to become readable. * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * asio::error_code ec; * acceptor.wait(asio::ip::tcp::acceptor::wait_read, ec); @@ -953,7 +953,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * @code @@ -967,7 +967,7 @@ public: * * ... * - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * acceptor.async_wait( * asio::ip::tcp::acceptor::wait_read, @@ -999,9 +999,9 @@ public: * * @par Example * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * acceptor.accept(socket); * @endcode */ @@ -1027,9 +1027,9 @@ public: * * @par Example * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * asio::error_code ec; * acceptor.accept(socket, ec); * if (ec) @@ -1066,7 +1066,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * @code @@ -1080,9 +1080,9 @@ public: * * ... * - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * acceptor.async_accept(socket, accept_handler); * @endcode */ @@ -1118,9 +1118,9 @@ public: * * @par Example * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * asio::ip::tcp::endpoint endpoint; * acceptor.accept(socket, endpoint); * @endcode @@ -1151,9 +1151,9 @@ public: * * @par Example * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * asio::ip::tcp::endpoint endpoint; * asio::error_code ec; * acceptor.accept(socket, endpoint, ec); @@ -1196,7 +1196,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). */ template ASIO_INITFN_RESULT_TYPE(AcceptHandler, @@ -1228,7 +1228,7 @@ public: * * @par Example * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * asio::ip::tcp::socket socket(acceptor.accept()); * @endcode @@ -1259,7 +1259,7 @@ public: * * @par Example * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * asio::ip::tcp::socket socket(acceptor.accept(ec)); * if (ec) @@ -1291,7 +1291,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * @code @@ -1306,7 +1306,7 @@ public: * * ... * - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * acceptor.async_accept(accept_handler); * @endcode @@ -1322,7 +1322,7 @@ public: handler, typename Protocol::socket) type_check; return this->get_service().async_accept( - this->get_implementation(), static_cast(0), + this->get_implementation(), static_cast(0), static_cast(0), ASIO_MOVE_CAST(MoveAcceptHandler)(handler)); } @@ -1336,7 +1336,7 @@ public: * This overload requires that the Protocol template parameter satisfy the * AcceptableProtocol type requirements. * - * @param io_service The io_service object to be used for the newly accepted + * @param io_context The io_context object to be used for the newly accepted * socket. * * @returns A socket object representing the newly accepted connection. @@ -1345,17 +1345,17 @@ public: * * @par Example * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * asio::ip::tcp::socket socket(acceptor.accept()); * @endcode */ - typename Protocol::socket accept(asio::io_service& io_service) + typename Protocol::socket accept(asio::io_context& io_context) { asio::error_code ec; typename Protocol::socket peer( this->get_service().accept(this->get_implementation(), - &io_service, static_cast(0), ec)); + &io_context, static_cast(0), ec)); asio::detail::throw_error(ec, "accept"); return peer; } @@ -1369,7 +1369,7 @@ public: * This overload requires that the Protocol template parameter satisfy the * AcceptableProtocol type requirements. * - * @param io_service The io_service object to be used for the newly accepted + * @param io_context The io_context object to be used for the newly accepted * socket. * * @param ec Set to indicate what error occurred, if any. @@ -1379,9 +1379,9 @@ public: * * @par Example * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... - * asio::ip::tcp::socket socket(acceptor.accept(io_service2, ec)); + * asio::ip::tcp::socket socket(acceptor.accept(io_context2, ec)); * if (ec) * { * // An error occurred. @@ -1389,10 +1389,10 @@ public: * @endcode */ typename Protocol::socket accept( - asio::io_service& io_service, asio::error_code& ec) + asio::io_context& io_context, asio::error_code& ec) { return this->get_service().accept(this->get_implementation(), - &io_service, static_cast(0), ec); + &io_context, static_cast(0), ec); } /// Start an asynchronous accept. @@ -1403,7 +1403,7 @@ public: * This overload requires that the Protocol template parameter satisfy the * AcceptableProtocol type requirements. * - * @param io_service The io_service object to be used for the newly accepted + * @param io_context The io_context object to be used for the newly accepted * socket. * * @param handler The handler to be called when the accept operation @@ -1416,7 +1416,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * @code @@ -1431,15 +1431,15 @@ public: * * ... * - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... - * acceptor.async_accept(io_service2, accept_handler); + * acceptor.async_accept(io_context2, accept_handler); * @endcode */ template ASIO_INITFN_RESULT_TYPE(MoveAcceptHandler, void (asio::error_code, typename Protocol::socket)) - async_accept(asio::io_service& io_service, + async_accept(asio::io_context& io_context, ASIO_MOVE_ARG(MoveAcceptHandler) handler) { // If you get an error on the following line it means that your handler does @@ -1448,7 +1448,7 @@ public: handler, typename Protocol::socket) type_check; return this->get_service().async_accept(this->get_implementation(), - &io_service, static_cast(0), + &io_context, static_cast(0), ASIO_MOVE_CAST(MoveAcceptHandler)(handler)); } @@ -1470,7 +1470,7 @@ public: * * @par Example * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * asio::ip::tcp::endpoint endpoint; * asio::ip::tcp::socket socket(acceptor.accept(endpoint)); @@ -1481,7 +1481,7 @@ public: asio::error_code ec; typename Protocol::socket peer( this->get_service().accept(this->get_implementation(), - static_cast(0), &peer_endpoint, ec)); + static_cast(0), &peer_endpoint, ec)); asio::detail::throw_error(ec, "accept"); return peer; } @@ -1505,7 +1505,7 @@ public: * * @par Example * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * asio::ip::tcp::endpoint endpoint; * asio::ip::tcp::socket socket(acceptor.accept(endpoint, ec)); @@ -1519,7 +1519,7 @@ public: endpoint_type& peer_endpoint, asio::error_code& ec) { return this->get_service().accept(this->get_implementation(), - static_cast(0), &peer_endpoint, ec); + static_cast(0), &peer_endpoint, ec); } /// Start an asynchronous accept. @@ -1545,7 +1545,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * @code @@ -1560,7 +1560,7 @@ public: * * ... * - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * asio::ip::tcp::endpoint endpoint; * acceptor.async_accept(endpoint, accept_handler); @@ -1578,7 +1578,7 @@ public: handler, typename Protocol::socket) type_check; return this->get_service().async_accept(this->get_implementation(), - static_cast(0), &peer_endpoint, + static_cast(0), &peer_endpoint, ASIO_MOVE_CAST(MoveAcceptHandler)(handler)); } @@ -1591,7 +1591,7 @@ public: * This overload requires that the Protocol template parameter satisfy the * AcceptableProtocol type requirements. * - * @param io_service The io_service object to be used for the newly accepted + * @param io_context The io_context object to be used for the newly accepted * socket. * * @param peer_endpoint An endpoint object into which the endpoint of the @@ -1603,20 +1603,20 @@ public: * * @par Example * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * asio::ip::tcp::endpoint endpoint; * asio::ip::tcp::socket socket( - * acceptor.accept(io_service2, endpoint)); + * acceptor.accept(io_context2, endpoint)); * @endcode */ typename Protocol::socket accept( - asio::io_service& io_service, endpoint_type& peer_endpoint) + asio::io_context& io_context, endpoint_type& peer_endpoint) { asio::error_code ec; typename Protocol::socket peer( this->get_service().accept(this->get_implementation(), - &io_service, &peer_endpoint, ec)); + &io_context, &peer_endpoint, ec)); asio::detail::throw_error(ec, "accept"); return peer; } @@ -1630,7 +1630,7 @@ public: * This overload requires that the Protocol template parameter satisfy the * AcceptableProtocol type requirements. * - * @param io_service The io_service object to be used for the newly accepted + * @param io_context The io_context object to be used for the newly accepted * socket. * * @param peer_endpoint An endpoint object into which the endpoint of the @@ -1643,22 +1643,22 @@ public: * * @par Example * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * asio::ip::tcp::endpoint endpoint; * asio::ip::tcp::socket socket( - * acceptor.accept(io_service2, endpoint, ec)); + * acceptor.accept(io_context2, endpoint, ec)); * if (ec) * { * // An error occurred. * } * @endcode */ - typename Protocol::socket accept(asio::io_service& io_service, + typename Protocol::socket accept(asio::io_context& io_context, endpoint_type& peer_endpoint, asio::error_code& ec) { return this->get_service().accept(this->get_implementation(), - &io_service, &peer_endpoint, ec); + &io_context, &peer_endpoint, ec); } /// Start an asynchronous accept. @@ -1669,7 +1669,7 @@ public: * This overload requires that the Protocol template parameter satisfy the * AcceptableProtocol type requirements. * - * @param io_service The io_service object to be used for the newly accepted + * @param io_context The io_context object to be used for the newly accepted * socket. * * @param peer_endpoint An endpoint object into which the endpoint of the @@ -1687,7 +1687,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * @code @@ -1702,16 +1702,16 @@ public: * * ... * - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * asio::ip::tcp::endpoint endpoint; - * acceptor.async_accept(io_service2, endpoint, accept_handler); + * acceptor.async_accept(io_context2, endpoint, accept_handler); * @endcode */ template ASIO_INITFN_RESULT_TYPE(MoveAcceptHandler, void (asio::error_code, typename Protocol::socket)) - async_accept(asio::io_service& io_service, + async_accept(asio::io_context& io_context, endpoint_type& peer_endpoint, ASIO_MOVE_ARG(MoveAcceptHandler) handler) { @@ -1721,7 +1721,7 @@ public: handler, typename Protocol::socket) type_check; return this->get_service().async_accept( - this->get_implementation(), &io_service, &peer_endpoint, + this->get_implementation(), &io_context, &peer_endpoint, ASIO_MOVE_CAST(MoveAcceptHandler)(handler)); } #endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) diff --git a/asio/include/asio/basic_socket_streambuf.hpp b/asio/include/asio/basic_socket_streambuf.hpp index b413c198..f908d500 100644 --- a/asio/include/asio/basic_socket_streambuf.hpp +++ b/asio/include/asio/basic_socket_streambuf.hpp @@ -24,7 +24,7 @@ #include "asio/deadline_timer_service.hpp" #include "asio/detail/array.hpp" #include "asio/detail/throw_error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/stream_socket_service.hpp" #if defined(ASIO_HAS_BOOST_DATE_TIME) @@ -46,7 +46,7 @@ // init_buffers(); // this->basic_socket::close(ec_); // typedef typename Protocol::resolver resolver_type; -// resolver_type resolver(detail::socket_streambuf_base::io_service_); +// resolver_type resolver(detail::socket_streambuf_base::io_context_); // connect_to_endpoints( // resolver.resolve(x1, ..., xn, ec_)); // return !ec_ ? this : 0; @@ -62,7 +62,7 @@ init_buffers(); \ this->basic_socket::close(ec_); \ typedef typename Protocol::resolver resolver_type; \ - resolver_type resolver(detail::socket_streambuf_base::io_service_); \ + resolver_type resolver(detail::socket_streambuf_base::io_context_); \ connect_to_endpoints( \ resolver.resolve(ASIO_VARIADIC_BYVAL_ARGS(n), ec_)); \ return !ec_ ? this : 0; \ @@ -76,12 +76,12 @@ namespace asio { namespace detail { -// A separate base class is used to ensure that the io_service is initialised +// A separate base class is used to ensure that the io_context is initialised // prior to the basic_socket_streambuf's basic_socket base class. class socket_streambuf_base { protected: - io_service io_service_; + io_context io_context_; }; } // namespace detail @@ -141,7 +141,7 @@ public: /// Construct a basic_socket_streambuf without establishing a connection. basic_socket_streambuf() : basic_socket( - this->detail::socket_streambuf_base::io_service_), + this->detail::socket_streambuf_base::io_context_), unbuffered_(false), timer_service_(0), timer_state_(no_timer) @@ -184,8 +184,8 @@ public: endpoint, handler); ec_ = asio::error::would_block; - this->get_service().get_io_service().restart(); - do this->get_service().get_io_service().run_one(); + this->get_service().get_io_context().restart(); + do this->get_service().get_io_context().run_one(); while (ec_ == asio::error::would_block); return !ec_ ? this : 0; @@ -212,7 +212,7 @@ public: init_buffers(); this->basic_socket::close(ec_); typedef typename Protocol::resolver resolver_type; - resolver_type resolver(detail::socket_streambuf_base::io_service_); + resolver_type resolver(detail::socket_streambuf_base::io_context_); connect_to_endpoints(resolver.resolve(x..., ec_)); return !ec_ ? this : 0; } @@ -390,8 +390,8 @@ protected: 0, handler); ec_ = asio::error::would_block; - this->get_service().get_io_service().restart(); - do this->get_service().get_io_service().run_one(); + this->get_service().get_io_context().restart(); + do this->get_service().get_io_context().run_one(); while (ec_ == asio::error::would_block); if (ec_) return traits_type::eof(); @@ -430,8 +430,8 @@ protected: asio::buffer(&ch, sizeof(char_type)), 0, handler); ec_ = asio::error::would_block; - this->get_service().get_io_service().restart(); - do this->get_service().get_io_service().run_one(); + this->get_service().get_io_context().restart(); + do this->get_service().get_io_context().run_one(); while (ec_ == asio::error::would_block); if (ec_) return traits_type::eof(); @@ -457,8 +457,8 @@ protected: asio::buffer(buffer), 0, handler); ec_ = asio::error::would_block; - this->get_service().get_io_service().restart(); - do this->get_service().get_io_service().run_one(); + this->get_service().get_io_context().restart(); + do this->get_service().get_io_context().run_one(); while (ec_ == asio::error::would_block); if (ec_) return traits_type::eof(); @@ -540,8 +540,8 @@ private: *i, handler); ec_ = asio::error::would_block; - this->get_service().get_io_service().restart(); - do this->get_service().get_io_service().run_one(); + this->get_service().get_io_context().restart(); + do this->get_service().get_io_context().run_one(); while (ec_ == asio::error::would_block); ++i; @@ -600,7 +600,7 @@ private: if (timer_service_ == 0) { TimerService& timer_service = use_service( - detail::socket_streambuf_base::io_service_); + detail::socket_streambuf_base::io_context_); timer_service.construct(timer_implementation_); timer_service_ = &timer_service; } diff --git a/asio/include/asio/basic_stream_socket.hpp b/asio/include/asio/basic_stream_socket.hpp index c29827b8..47087865 100644 --- a/asio/include/asio/basic_stream_socket.hpp +++ b/asio/include/asio/basic_stream_socket.hpp @@ -61,11 +61,11 @@ public: * needs to be opened and then connected or accepted before data can be sent * or received on it. * - * @param io_service The io_service object that the stream socket will use to + * @param io_context The io_context object that the stream socket will use to * dispatch handlers for any asynchronous operations performed on the socket. */ - explicit basic_stream_socket(asio::io_service& io_service) - : basic_socket(io_service) + explicit basic_stream_socket(asio::io_context& io_context) + : basic_socket(io_context) { } @@ -74,16 +74,16 @@ public: * This constructor creates and opens a stream socket. The socket needs to be * connected or accepted before data can be sent or received on it. * - * @param io_service The io_service object that the stream socket will use to + * @param io_context The io_context object that the stream socket will use to * dispatch handlers for any asynchronous operations performed on the socket. * * @param protocol An object specifying protocol parameters to be used. * * @throws asio::system_error Thrown on failure. */ - basic_stream_socket(asio::io_service& io_service, + basic_stream_socket(asio::io_context& io_context, const protocol_type& protocol) - : basic_socket(io_service, protocol) + : basic_socket(io_context, protocol) { } @@ -94,7 +94,7 @@ public: * to the specified endpoint on the local machine. The protocol used is the * protocol associated with the given endpoint. * - * @param io_service The io_service object that the stream socket will use to + * @param io_context The io_context object that the stream socket will use to * dispatch handlers for any asynchronous operations performed on the socket. * * @param endpoint An endpoint on the local machine to which the stream @@ -102,9 +102,9 @@ public: * * @throws asio::system_error Thrown on failure. */ - basic_stream_socket(asio::io_service& io_service, + basic_stream_socket(asio::io_context& io_context, const endpoint_type& endpoint) - : basic_socket(io_service, endpoint) + : basic_socket(io_context, endpoint) { } @@ -113,7 +113,7 @@ public: * This constructor creates a stream socket object to hold an existing native * socket. * - * @param io_service The io_service object that the stream socket will use to + * @param io_context The io_context object that the stream socket will use to * dispatch handlers for any asynchronous operations performed on the socket. * * @param protocol An object specifying protocol parameters to be used. @@ -122,10 +122,10 @@ public: * * @throws asio::system_error Thrown on failure. */ - basic_stream_socket(asio::io_service& io_service, + basic_stream_socket(asio::io_context& io_context, const protocol_type& protocol, const native_handle_type& native_socket) : basic_socket( - io_service, protocol, native_socket) + io_context, protocol, native_socket) { } @@ -138,7 +138,7 @@ public: * will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_stream_socket(io_service&) constructor. + * constructed using the @c basic_stream_socket(io_context&) constructor. */ basic_stream_socket(basic_stream_socket&& other) : basic_socket( @@ -154,7 +154,7 @@ public: * will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_stream_socket(io_service&) constructor. + * constructed using the @c basic_stream_socket(io_context&) constructor. */ basic_stream_socket& operator=(basic_stream_socket&& other) { @@ -172,7 +172,7 @@ public: * will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_stream_socket(io_service&) constructor. + * constructed using the @c basic_stream_socket(io_context&) constructor. */ template basic_stream_socket( @@ -192,7 +192,7 @@ public: * will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_stream_socket(io_service&) constructor. + * constructed using the @c basic_stream_socket(io_context&) constructor. */ template typename enable_if::value, @@ -325,7 +325,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note The send operation may not transmit all of the data to the peer. * Consider using the @ref async_write function if you need to ensure that all @@ -377,7 +377,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note The send operation may not transmit all of the data to the peer. * Consider using the @ref async_write function if you need to ensure that all @@ -533,7 +533,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note The receive operation may not receive all of the requested number of * bytes. Consider using the @ref async_read function if you need to ensure @@ -586,7 +586,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note The receive operation may not receive all of the requested number of * bytes. Consider using the @ref async_read function if you need to ensure @@ -698,7 +698,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note The write operation may not transmit all of the data to the peer. * Consider using the @ref async_write function if you need to ensure that all @@ -810,7 +810,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note The read operation may not read all of the requested number of bytes. * Consider using the @ref async_read function if you need to ensure that the diff --git a/asio/include/asio/basic_waitable_timer.hpp b/asio/include/asio/basic_waitable_timer.hpp index d83bb51d..1a353702 100644 --- a/asio/include/asio/basic_waitable_timer.hpp +++ b/asio/include/asio/basic_waitable_timer.hpp @@ -51,7 +51,7 @@ namespace asio { * Performing a blocking wait (C++11): * @code * // Construct a timer without setting an expiry time. - * asio::steady_timer timer(io_service); + * asio::steady_timer timer(io_context); * * // Set an expiry time relative to now. * timer.expires_after(std::chrono::seconds(5)); @@ -74,7 +74,7 @@ namespace asio { * ... * * // Construct a timer with an absolute expiry time. - * asio::steady_timer timer(io_service, + * asio::steady_timer timer(io_context, * std::chrono::steady_clock::now() + std::chrono::seconds(60)); * * // Start an asynchronous wait. @@ -145,11 +145,11 @@ public: * expires_at() or expires_after() functions must be called to set an expiry * time before the timer can be waited on. * - * @param io_service The io_service object that the timer will use to dispatch + * @param io_context The io_context object that the timer will use to dispatch * handlers for any asynchronous operations performed on the timer. */ - explicit basic_waitable_timer(asio::io_service& io_service) - : basic_io_object(io_service) + explicit basic_waitable_timer(asio::io_context& io_context) + : basic_io_object(io_context) { } @@ -157,15 +157,15 @@ public: /** * This constructor creates a timer and sets the expiry time. * - * @param io_service The io_service object that the timer will use to dispatch + * @param io_context The io_context object that the timer will use to dispatch * handlers for any asynchronous operations performed on the timer. * * @param expiry_time The expiry time to be used for the timer, expressed * as an absolute time. */ - basic_waitable_timer(asio::io_service& io_service, + basic_waitable_timer(asio::io_context& io_context, const time_point& expiry_time) - : basic_io_object(io_service) + : basic_io_object(io_context) { asio::error_code ec; this->get_service().expires_at(this->get_implementation(), expiry_time, ec); @@ -176,15 +176,15 @@ public: /** * This constructor creates a timer and sets the expiry time. * - * @param io_service The io_service object that the timer will use to dispatch + * @param io_context The io_context object that the timer will use to dispatch * handlers for any asynchronous operations performed on the timer. * * @param expiry_time The expiry time to be used for the timer, relative to * now. */ - basic_waitable_timer(asio::io_service& io_service, + basic_waitable_timer(asio::io_context& io_context, const duration& expiry_time) - : basic_io_object(io_service) + : basic_io_object(io_context) { asio::error_code ec; this->get_service().expires_after( @@ -201,7 +201,7 @@ public: * occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_waitable_timer(io_service&) constructor. + * constructed using the @c basic_waitable_timer(io_context&) constructor. */ basic_waitable_timer(basic_waitable_timer&& other) : basic_io_object( @@ -217,7 +217,7 @@ public: * occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_waitable_timer(io_service&) constructor. + * constructed using the @c basic_waitable_timer(io_context&) constructor. */ basic_waitable_timer& operator=(basic_waitable_timer&& other) { @@ -611,7 +611,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). */ template ASIO_INITFN_RESULT_TYPE(WaitHandler, diff --git a/asio/include/asio/buffered_read_stream.hpp b/asio/include/asio/buffered_read_stream.hpp index 1a87b811..f58e4eb3 100644 --- a/asio/include/asio/buffered_read_stream.hpp +++ b/asio/include/asio/buffered_read_stream.hpp @@ -26,7 +26,7 @@ #include "asio/detail/noncopyable.hpp" #include "asio/detail/type_traits.hpp" #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/detail/push_options.hpp" @@ -96,11 +96,20 @@ public: return next_layer_.lowest_layer(); } - /// Get the io_service associated with the object. - asio::io_service& get_io_service() + /// Get the io_context associated with the object. + asio::io_context& get_io_context() + { + return next_layer_.get_io_context(); + } + +#if !defined(ASIO_NO_DEPRECATED) + /// (Deprecated: Use get_io_context().) Get the io_context associated with the + /// object. + asio::io_context& get_io_service() { return next_layer_.get_io_service(); } +#endif // !defined(ASIO_NO_DEPRECATED) /// Close the stream. void close() diff --git a/asio/include/asio/buffered_stream.hpp b/asio/include/asio/buffered_stream.hpp index 6a35da91..0e840138 100644 --- a/asio/include/asio/buffered_stream.hpp +++ b/asio/include/asio/buffered_stream.hpp @@ -23,7 +23,7 @@ #include "asio/buffered_stream_fwd.hpp" #include "asio/detail/noncopyable.hpp" #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/detail/push_options.hpp" @@ -87,11 +87,20 @@ public: return stream_impl_.lowest_layer(); } - /// Get the io_service associated with the object. - asio::io_service& get_io_service() + /// Get the io_context associated with the object. + asio::io_context& get_io_context() + { + return stream_impl_.get_io_context(); + } + +#if !defined(ASIO_NO_DEPRECATED) + /// (Deprecated: Use get_io_context().) Get the io_context associated with the + /// object. + asio::io_context& get_io_service() { return stream_impl_.get_io_service(); } +#endif // !defined(ASIO_NO_DEPRECATED) /// Close the stream. void close() diff --git a/asio/include/asio/buffered_write_stream.hpp b/asio/include/asio/buffered_write_stream.hpp index 7572fc52..0b5ef89e 100644 --- a/asio/include/asio/buffered_write_stream.hpp +++ b/asio/include/asio/buffered_write_stream.hpp @@ -25,7 +25,7 @@ #include "asio/detail/noncopyable.hpp" #include "asio/detail/type_traits.hpp" #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/write.hpp" #include "asio/detail/push_options.hpp" @@ -96,11 +96,20 @@ public: return next_layer_.lowest_layer(); } - /// Get the io_service associated with the object. - asio::io_service& get_io_service() + /// Get the io_context associated with the object. + asio::io_context& get_io_context() + { + return next_layer_.get_io_context(); + } + +#if !defined(ASIO_NO_DEPRECATED) + /// (Deprecated: Use get_io_context().) Get the io_context associated with the + /// object. + asio::io_context& get_io_service() { return next_layer_.get_io_service(); } +#endif // !defined(ASIO_NO_DEPRECATED) /// Close the stream. void close() diff --git a/asio/include/asio/connect.hpp b/asio/include/asio/connect.hpp index 7d0bab33..f63f3354 100644 --- a/asio/include/asio/connect.hpp +++ b/asio/include/asio/connect.hpp @@ -81,9 +81,9 @@ struct is_endpoint_sequence * Otherwise, contains the error from the last connection attempt. * * @par Example - * @code tcp::resolver r(io_service); + * @code tcp::resolver r(io_context); * tcp::resolver::query q("host", "service"); - * tcp::socket s(io_service); + * tcp::socket s(io_context); * asio::connect(s, r.resolve(q)); @endcode */ template @@ -112,9 +112,9 @@ typename Protocol::endpoint connect(basic_socket& s, * default-constructed endpoint. * * @par Example - * @code tcp::resolver r(io_service); + * @code tcp::resolver r(io_context); * tcp::resolver::query q("host", "service"); - * tcp::socket s(io_service); + * tcp::socket s(io_context); * asio::error_code ec; * asio::connect(s, r.resolve(q), ec); * if (ec) @@ -208,10 +208,10 @@ Iterator connect(basic_socket& s, * Otherwise, contains the error from the last connection attempt. * * @par Example - * @code tcp::resolver r(io_service); + * @code tcp::resolver r(io_context); * tcp::resolver::query q("host", "service"); * tcp::resolver::results_type e = r.resolve(q); - * tcp::socket s(io_service); + * tcp::socket s(io_context); * asio::connect(s, e.begin(), e.end()); @endcode */ template @@ -240,10 +240,10 @@ Iterator connect(basic_socket& s, * endpoint. Otherwise, the end iterator. * * @par Example - * @code tcp::resolver r(io_service); + * @code tcp::resolver r(io_context); * tcp::resolver::query q("host", "service"); * tcp::resolver::results_type e = r.resolve(q); - * tcp::socket s(io_service); + * tcp::socket s(io_context); * asio::error_code ec; * asio::connect(s, e.begin(), e.end(), ec); * if (ec) @@ -299,9 +299,9 @@ Iterator connect(basic_socket& s, * } * }; @endcode * It would be used with the asio::connect function as follows: - * @code tcp::resolver r(io_service); + * @code tcp::resolver r(io_context); * tcp::resolver::query q("host", "service"); - * tcp::socket s(io_service); + * tcp::socket s(io_context); * tcp::endpoint e = asio::connect(s, * r.resolve(q), my_connect_condition()); * std::cout << "Connected to: " << e << std::endl; @endcode @@ -358,9 +358,9 @@ typename Protocol::endpoint connect(basic_socket& s, * } * }; @endcode * It would be used with the asio::connect function as follows: - * @code tcp::resolver r(io_service); + * @code tcp::resolver r(io_context); * tcp::resolver::query q("host", "service"); - * tcp::socket s(io_service); + * tcp::socket s(io_context); * asio::error_code ec; * tcp::endpoint e = asio::connect(s, * r.resolve(q), my_connect_condition(), ec); @@ -511,10 +511,10 @@ Iterator connect(basic_socket& s, Iterator begin, * } * }; @endcode * It would be used with the asio::connect function as follows: - * @code tcp::resolver r(io_service); + * @code tcp::resolver r(io_context); * tcp::resolver::query q("host", "service"); * tcp::resolver::results_type e = r.resolve(q); - * tcp::socket s(io_service); + * tcp::socket s(io_context); * tcp::resolver::results_type::iterator i = asio::connect( * s, e.begin(), e.end(), my_connect_condition()); * std::cout << "Connected to: " << i->endpoint() << std::endl; @endcode @@ -571,10 +571,10 @@ Iterator connect(basic_socket& s, Iterator begin, * } * }; @endcode * It would be used with the asio::connect function as follows: - * @code tcp::resolver r(io_service); + * @code tcp::resolver r(io_context); * tcp::resolver::query q("host", "service"); * tcp::resolver::results_type e = r.resolve(q); - * tcp::socket s(io_service); + * tcp::socket s(io_context); * asio::error_code ec; * tcp::resolver::results_type::iterator i = asio::connect( * s, e.begin(), e.end(), my_connect_condition()); @@ -632,12 +632,12 @@ Iterator connect(basic_socket& s, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example - * @code tcp::resolver r(io_service); + * @code tcp::resolver r(io_context); * tcp::resolver::query q("host", "service"); - * tcp::socket s(io_service); + * tcp::socket s(io_context); * * // ... * @@ -704,7 +704,7 @@ async_connect(basic_socket& s, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note This overload assumes that a default constructed object of type @c * Iterator represents the end of the sequence. This is a valid assumption for @@ -750,11 +750,11 @@ async_connect(basic_socket& s, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * @code std::vector endpoints = ...; - * tcp::socket s(io_service); + * tcp::socket s(io_context); * asio::async_connect(s, * endpoints.begin(), endpoints.end(), * connect_handler); @@ -816,7 +816,7 @@ async_connect(basic_socket& s, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * The following connect condition function object can be used to output @@ -833,9 +833,9 @@ async_connect(basic_socket& s, * } * }; @endcode * It would be used with the asio::connect function as follows: - * @code tcp::resolver r(io_service); + * @code tcp::resolver r(io_context); * tcp::resolver::query q("host", "service"); - * tcp::socket s(io_service); + * tcp::socket s(io_context); * * // ... * @@ -922,7 +922,7 @@ async_connect(basic_socket& s, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note This overload assumes that a default constructed object of type @c * Iterator represents the end of the sequence. This is a valid assumption for @@ -980,7 +980,7 @@ async_connect(basic_socket& s, Iterator begin, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * The following connect condition function object can be used to output @@ -997,9 +997,9 @@ async_connect(basic_socket& s, Iterator begin, * } * }; @endcode * It would be used with the asio::connect function as follows: - * @code tcp::resolver r(io_service); + * @code tcp::resolver r(io_context); * tcp::resolver::query q("host", "service"); - * tcp::socket s(io_service); + * tcp::socket s(io_context); * * // ... * diff --git a/asio/include/asio/coroutine.hpp b/asio/include/asio/coroutine.hpp index d9dfaaa6..ca456b24 100644 --- a/asio/include/asio/coroutine.hpp +++ b/asio/include/asio/coroutine.hpp @@ -205,7 +205,7 @@ class coroutine_ref; * { * do * { - * socket_.reset(new tcp::socket(io_service_)); + * socket_.reset(new tcp::socket(io_context_)); * yield acceptor->async_accept(*socket_, *this); * fork server(*this)(); * } while (is_parent()); @@ -227,7 +227,7 @@ class coroutine_ref; * Note that @c fork doesn't do the actual forking by itself. It is the * application's responsibility to create a clone of the coroutine and call it. * The clone can be called immediately, as above, or scheduled for delayed - * execution using something like io_service::post(). + * execution using something like io_context::post(). * * @par Alternate macro names * diff --git a/asio/include/asio/datagram_socket_service.hpp b/asio/include/asio/datagram_socket_service.hpp index e1972aba..d8f80884 100644 --- a/asio/include/asio/datagram_socket_service.hpp +++ b/asio/include/asio/datagram_socket_service.hpp @@ -20,7 +20,7 @@ #include "asio/async_result.hpp" #include "asio/detail/type_traits.hpp" #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #if defined(ASIO_WINDOWS_RUNTIME) # include "asio/detail/null_socket_service.hpp" @@ -38,7 +38,7 @@ namespace asio { template class datagram_socket_service #if defined(GENERATING_DOCUMENTATION) - : public asio::io_service::service + : public asio::io_context::service #else : public asio::detail::service_base > #endif @@ -46,7 +46,7 @@ class datagram_socket_service public: #if defined(GENERATING_DOCUMENTATION) /// The unique service identifier. - static asio::io_service::id id; + static asio::io_context::id id; #endif /// The protocol type. @@ -80,11 +80,11 @@ public: typedef typename service_impl_type::native_handle_type native_handle_type; #endif - /// Construct a new datagram socket service for the specified io_service. - explicit datagram_socket_service(asio::io_service& io_service) + /// Construct a new datagram socket service for the specified io_context. + explicit datagram_socket_service(asio::io_context& io_context) : asio::detail::service_base< - datagram_socket_service >(io_service), - service_impl_(io_service) + datagram_socket_service >(io_context), + service_impl_(io_context) { } diff --git a/asio/include/asio/deadline_timer_service.hpp b/asio/include/asio/deadline_timer_service.hpp index 57cd5993..cbc06182 100644 --- a/asio/include/asio/deadline_timer_service.hpp +++ b/asio/include/asio/deadline_timer_service.hpp @@ -23,7 +23,7 @@ #include #include "asio/async_result.hpp" #include "asio/detail/deadline_timer_service.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/time_traits.hpp" #include "asio/detail/timer_queue_ptime.hpp" @@ -36,7 +36,7 @@ template > class deadline_timer_service #if defined(GENERATING_DOCUMENTATION) - : public asio::io_service::service + : public asio::io_context::service #else : public asio::detail::service_base< deadline_timer_service > @@ -45,7 +45,7 @@ class deadline_timer_service public: #if defined(GENERATING_DOCUMENTATION) /// The unique service identifier. - static asio::io_service::id id; + static asio::io_context::id id; #endif /// The time traits type. @@ -69,11 +69,11 @@ public: typedef typename service_impl_type::implementation_type implementation_type; #endif - /// Construct a new timer service for the specified io_service. - explicit deadline_timer_service(asio::io_service& io_service) + /// Construct a new timer service for the specified io_context. + explicit deadline_timer_service(asio::io_context& io_context) : asio::detail::service_base< - deadline_timer_service >(io_service), - service_impl_(io_service) + deadline_timer_service >(io_context), + service_impl_(io_context) { } diff --git a/asio/include/asio/detail/call_stack.hpp b/asio/include/asio/detail/call_stack.hpp index fa763e6b..b700a005 100644 --- a/asio/include/asio/detail/call_stack.hpp +++ b/asio/include/asio/detail/call_stack.hpp @@ -25,7 +25,7 @@ namespace asio { namespace detail { // Helper class to determine whether or not the current thread is inside an -// invocation of io_service::run() for a specified io_service object. +// invocation of io_context::run() for a specified io_context object. template class call_stack { diff --git a/asio/include/asio/detail/deadline_timer_service.hpp b/asio/include/asio/detail/deadline_timer_service.hpp index f6f17d57..2a203b4b 100644 --- a/asio/include/asio/detail/deadline_timer_service.hpp +++ b/asio/include/asio/detail/deadline_timer_service.hpp @@ -18,7 +18,7 @@ #include "asio/detail/config.hpp" #include #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/detail/bind_handler.hpp" #include "asio/detail/fenced_block.hpp" #include "asio/detail/memory.hpp" @@ -61,8 +61,8 @@ public: }; // Constructor. - deadline_timer_service(asio::io_service& io_service) - : scheduler_(asio::use_service(io_service)) + deadline_timer_service(asio::io_context& io_context) + : scheduler_(asio::use_service(io_context)) { scheduler_.init_task(); scheduler_.add_timer_queue(timer_queue_); diff --git a/asio/include/asio/detail/impl/dev_poll_reactor.ipp b/asio/include/asio/detail/impl/dev_poll_reactor.ipp index f0f408d2..a1148e3f 100644 --- a/asio/include/asio/detail/impl/dev_poll_reactor.ipp +++ b/asio/include/asio/detail/impl/dev_poll_reactor.ipp @@ -67,7 +67,7 @@ void dev_poll_reactor::shutdown_service() scheduler_.abandon_operations(ops); } -void dev_poll_reactor::fork_service(asio::io_service::fork_event fork_ev) +void dev_poll_reactor::fork_service(asio::io_context::fork_event fork_ev) { if (fork_ev == asio::execution_context::fork_child) { diff --git a/asio/include/asio/detail/impl/reactive_descriptor_service.ipp b/asio/include/asio/detail/impl/reactive_descriptor_service.ipp index 666f1d89..37ddaf21 100644 --- a/asio/include/asio/detail/impl/reactive_descriptor_service.ipp +++ b/asio/include/asio/detail/impl/reactive_descriptor_service.ipp @@ -30,8 +30,8 @@ namespace asio { namespace detail { reactive_descriptor_service::reactive_descriptor_service( - asio::io_service& io_service) - : reactor_(asio::use_service(io_service)) + asio::io_context& io_context) + : reactor_(asio::use_service(io_context)) { reactor_.init_task(); } diff --git a/asio/include/asio/detail/impl/reactive_serial_port_service.ipp b/asio/include/asio/detail/impl/reactive_serial_port_service.ipp index b3ce7b96..49a94a4e 100644 --- a/asio/include/asio/detail/impl/reactive_serial_port_service.ipp +++ b/asio/include/asio/detail/impl/reactive_serial_port_service.ipp @@ -30,8 +30,8 @@ namespace asio { namespace detail { reactive_serial_port_service::reactive_serial_port_service( - asio::io_service& io_service) - : descriptor_service_(io_service) + asio::io_context& io_context) + : descriptor_service_(io_context) { } diff --git a/asio/include/asio/detail/impl/reactive_socket_service_base.ipp b/asio/include/asio/detail/impl/reactive_socket_service_base.ipp index 6e7d2405..76d6da2d 100644 --- a/asio/include/asio/detail/impl/reactive_socket_service_base.ipp +++ b/asio/include/asio/detail/impl/reactive_socket_service_base.ipp @@ -28,9 +28,9 @@ namespace asio { namespace detail { reactive_socket_service_base::reactive_socket_service_base( - asio::io_service& io_service) - : io_service_(io_service), - reactor_(use_service(io_service)) + asio::io_context& io_context) + : io_context_(io_context), + reactor_(use_service(io_context)) { reactor_.init_task(); } diff --git a/asio/include/asio/detail/impl/resolver_service_base.ipp b/asio/include/asio/detail/impl/resolver_service_base.ipp index 92798d2d..0f14374f 100644 --- a/asio/include/asio/detail/impl/resolver_service_base.ipp +++ b/asio/include/asio/detail/impl/resolver_service_base.ipp @@ -23,23 +23,23 @@ namespace asio { namespace detail { -class resolver_service_base::work_io_service_runner +class resolver_service_base::work_io_context_runner { public: - work_io_service_runner(asio::io_service& io_service) - : io_service_(io_service) {} - void operator()() { io_service_.run(); } + work_io_context_runner(asio::io_context& io_context) + : io_context_(io_context) {} + void operator()() { io_context_.run(); } private: - asio::io_service& io_service_; + asio::io_context& io_context_; }; resolver_service_base::resolver_service_base( - asio::io_service& io_service) - : io_service_impl_(asio::use_service(io_service)), - work_io_service_(new asio::io_service), - work_io_service_impl_(asio::use_service< - io_service_impl>(*work_io_service_)), - work_(new asio::io_service::work(*work_io_service_)), + asio::io_context& io_context) + : io_context_impl_(asio::use_service(io_context)), + work_io_context_(new asio::io_context), + work_io_context_impl_(asio::use_service< + io_context_impl>(*work_io_context_)), + work_(new asio::io_context::work(*work_io_context_)), work_thread_(0) { } @@ -52,33 +52,33 @@ resolver_service_base::~resolver_service_base() void resolver_service_base::shutdown_service() { work_.reset(); - if (work_io_service_.get()) + if (work_io_context_.get()) { - work_io_service_->stop(); + work_io_context_->stop(); if (work_thread_.get()) { work_thread_->join(); work_thread_.reset(); } - work_io_service_.reset(); + work_io_context_.reset(); } } void resolver_service_base::fork_service( - asio::io_service::fork_event fork_ev) + asio::io_context::fork_event fork_ev) { if (work_thread_.get()) { - if (fork_ev == asio::io_service::fork_prepare) + if (fork_ev == asio::io_context::fork_prepare) { - work_io_service_->stop(); + work_io_context_->stop(); work_thread_->join(); } else { - work_io_service_->restart(); + work_io_context_->restart(); work_thread_.reset(new asio::detail::thread( - work_io_service_runner(*work_io_service_))); + work_io_context_runner(*work_io_context_))); } } } @@ -92,7 +92,7 @@ void resolver_service_base::construct( void resolver_service_base::destroy( resolver_service_base::implementation_type& impl) { - ASIO_HANDLER_OPERATION((io_service_impl_.context(), + ASIO_HANDLER_OPERATION((io_context_impl_.context(), "resolver", &impl, 0, "cancel")); impl.reset(); @@ -101,7 +101,7 @@ void resolver_service_base::destroy( void resolver_service_base::cancel( resolver_service_base::implementation_type& impl) { - ASIO_HANDLER_OPERATION((io_service_impl_.context(), + ASIO_HANDLER_OPERATION((io_context_impl_.context(), "resolver", &impl, 0, "cancel")); impl.reset(static_cast(0), socket_ops::noop_deleter()); @@ -110,8 +110,8 @@ void resolver_service_base::cancel( void resolver_service_base::start_resolve_op(operation* op) { start_work_thread(); - io_service_impl_.work_started(); - work_io_service_impl_.post_immediate_completion(op, false); + io_context_impl_.work_started(); + work_io_context_impl_.post_immediate_completion(op, false); } void resolver_service_base::start_work_thread() @@ -120,7 +120,7 @@ void resolver_service_base::start_work_thread() if (!work_thread_.get()) { work_thread_.reset(new asio::detail::thread( - work_io_service_runner(*work_io_service_))); + work_io_context_runner(*work_io_context_))); } } diff --git a/asio/include/asio/detail/impl/service_registry.hpp b/asio/include/asio/detail/impl/service_registry.hpp index a6c1d9cc..efa4733a 100644 --- a/asio/include/asio/detail/impl/service_registry.hpp +++ b/asio/include/asio/detail/impl/service_registry.hpp @@ -30,11 +30,11 @@ Service& service_registry::use_service() } template -Service& service_registry::use_service(io_service& owner) +Service& service_registry::use_service(io_context& owner) { execution_context::service::key key; init_key(key, Service::id); - factory_type factory = &service_registry::create; + factory_type factory = &service_registry::create; return *static_cast(do_use_service(key, factory, &owner)); } diff --git a/asio/include/asio/detail/impl/signal_set_service.ipp b/asio/include/asio/detail/impl/signal_set_service.ipp index f219e74c..252caf29 100644 --- a/asio/include/asio/detail/impl/signal_set_service.ipp +++ b/asio/include/asio/detail/impl/signal_set_service.ipp @@ -117,12 +117,12 @@ public: // && !defined(__CYGWIN__) signal_set_service::signal_set_service( - asio::io_service& io_service) - : io_service_(asio::use_service(io_service)), + asio::io_context& io_context) + : io_context_(asio::use_service(io_context)), #if !defined(ASIO_WINDOWS) \ && !defined(ASIO_WINDOWS_RUNTIME) \ && !defined(__CYGWIN__) - reactor_(asio::use_service(io_service)), + reactor_(asio::use_service(io_context)), #endif // !defined(ASIO_WINDOWS) // && !defined(ASIO_WINDOWS_RUNTIME) // && !defined(__CYGWIN__) @@ -166,11 +166,11 @@ void signal_set_service::shutdown_service() } } - io_service_.abandon_operations(ops); + io_context_.abandon_operations(ops); } void signal_set_service::fork_service( - asio::io_service::fork_event fork_ev) + asio::io_context::fork_event fork_ev) { #if !defined(ASIO_WINDOWS) \ && !defined(ASIO_WINDOWS_RUNTIME) \ @@ -180,7 +180,7 @@ void signal_set_service::fork_service( switch (fork_ev) { - case asio::io_service::fork_prepare: + case asio::io_context::fork_prepare: { int read_descriptor = state->read_descriptor_; state->fork_prepared_ = true; @@ -188,7 +188,7 @@ void signal_set_service::fork_service( reactor_.deregister_internal_descriptor(read_descriptor, reactor_data_); } break; - case asio::io_service::fork_parent: + case asio::io_context::fork_parent: if (state->fork_prepared_) { int read_descriptor = state->read_descriptor_; @@ -198,7 +198,7 @@ void signal_set_service::fork_service( read_descriptor, reactor_data_, new pipe_read_op); } break; - case asio::io_service::fork_child: + case asio::io_context::fork_child: if (state->fork_prepared_) { asio::detail::signal_blocker blocker; @@ -437,7 +437,7 @@ asio::error_code signal_set_service::cancel( signal_set_service::implementation_type& impl, asio::error_code& ec) { - ASIO_HANDLER_OPERATION((io_service_.context(), + ASIO_HANDLER_OPERATION((io_context_.context(), "signal_set", &impl, 0, "cancel")); op_queue ops; @@ -453,7 +453,7 @@ asio::error_code signal_set_service::cancel( } } - io_service_.post_deferred_completions(ops); + io_context_.post_deferred_completions(ops); ec = asio::error_code(); return ec; @@ -489,7 +489,7 @@ void signal_set_service::deliver_signal(int signal_number) reg = reg->next_in_table_; } - service->io_service_.post_deferred_completions(ops); + service->io_context_.post_deferred_completions(ops); service = service->next_; } @@ -618,7 +618,7 @@ void signal_set_service::close_descriptors() void signal_set_service::start_wait_op( signal_set_service::implementation_type& impl, signal_op* op) { - io_service_.work_started(); + io_context_.work_started(); signal_state* state = get_signal_state(); static_mutex::scoped_lock lock(state->mutex_); @@ -630,7 +630,7 @@ void signal_set_service::start_wait_op( { --reg->undelivered_; op->signal_number_ = reg->signal_number_; - io_service_.post_deferred_completion(op); + io_context_.post_deferred_completion(op); return; } diff --git a/asio/include/asio/detail/impl/strand_service.hpp b/asio/include/asio/detail/impl/strand_service.hpp index 09f96dab..2e07fac1 100644 --- a/asio/include/asio/detail/impl/strand_service.hpp +++ b/asio/include/asio/detail/impl/strand_service.hpp @@ -35,7 +35,7 @@ inline strand_service::strand_impl::strand_impl() struct strand_service::on_dispatch_exit { - io_service_impl* io_service_; + io_context_impl* io_context_; strand_impl* impl_; ~on_dispatch_exit() @@ -46,7 +46,7 @@ struct strand_service::on_dispatch_exit impl_->mutex_.unlock(); if (more_handlers) - io_service_->post_immediate_completion(impl_, false); + io_context_->post_immediate_completion(impl_, false); } }; @@ -81,15 +81,15 @@ void strand_service::dispatch(strand_service::implementation_type& impl, call_stack::context ctx(impl); // Ensure the next handler, if any, is scheduled on block exit. - on_dispatch_exit on_exit = { &io_service_, impl }; + on_dispatch_exit on_exit = { &io_context_, impl }; (void)on_exit; completion_handler::do_complete( - &io_service_, o, asio::error_code(), 0); + &io_context_, o, asio::error_code(), 0); } } -// Request the io_service to invoke the given handler and return immediately. +// Request the io_context to invoke the given handler and return immediately. template void strand_service::post(strand_service::implementation_type& impl, Handler& handler) diff --git a/asio/include/asio/detail/impl/strand_service.ipp b/asio/include/asio/detail/impl/strand_service.ipp index 0aedaa98..c7539b57 100644 --- a/asio/include/asio/detail/impl/strand_service.ipp +++ b/asio/include/asio/detail/impl/strand_service.ipp @@ -26,7 +26,7 @@ namespace detail { struct strand_service::on_do_complete_exit { - io_service_impl* owner_; + io_context_impl* owner_; strand_impl* impl_; ~on_do_complete_exit() @@ -41,9 +41,9 @@ struct strand_service::on_do_complete_exit } }; -strand_service::strand_service(asio::io_service& io_service) - : asio::detail::service_base(io_service), - io_service_(asio::use_service(io_service)), +strand_service::strand_service(asio::io_context& io_context) + : asio::detail::service_base(io_context), + io_context_(asio::use_service(io_context)), mutex_(), salt_(0) { @@ -92,9 +92,9 @@ bool strand_service::running_in_this_thread( bool strand_service::do_dispatch(implementation_type& impl, operation* op) { - // If we are running inside the io_service, and no other handler already + // If we are running inside the io_context, and no other handler already // holds the strand lock, then the handler can run immediately. - bool can_dispatch = io_service_.can_dispatch(); + bool can_dispatch = io_context_.can_dispatch(); impl->mutex_.lock(); if (can_dispatch && !impl->locked_) { @@ -117,7 +117,7 @@ bool strand_service::do_dispatch(implementation_type& impl, operation* op) impl->locked_ = true; impl->mutex_.unlock(); impl->ready_queue_.push(op); - io_service_.post_immediate_completion(impl, false); + io_context_.post_immediate_completion(impl, false); } return false; @@ -140,7 +140,7 @@ void strand_service::do_post(implementation_type& impl, impl->locked_ = true; impl->mutex_.unlock(); impl->ready_queue_.push(op); - io_service_.post_immediate_completion(impl, is_continuation); + io_context_.post_immediate_completion(impl, is_continuation); } } @@ -156,7 +156,7 @@ void strand_service::do_complete(void* owner, operation* base, // Ensure the next handler, if any, is scheduled on block exit. on_do_complete_exit on_exit; - on_exit.owner_ = static_cast(owner); + on_exit.owner_ = static_cast(owner); on_exit.impl_ = impl; // Run all ready handlers. No lock is required since the ready queue is diff --git a/asio/include/asio/detail/impl/win_iocp_handle_service.ipp b/asio/include/asio/detail/impl/win_iocp_handle_service.ipp index 6b122a96..27d757fa 100644 --- a/asio/include/asio/detail/impl/win_iocp_handle_service.ipp +++ b/asio/include/asio/detail/impl/win_iocp_handle_service.ipp @@ -66,8 +66,8 @@ public: }; win_iocp_handle_service::win_iocp_handle_service( - asio::io_service& io_service) - : iocp_service_(asio::use_service(io_service)), + asio::io_context& io_context) + : iocp_service_(asio::use_service(io_context)), mutex_(), impl_list_(0) { diff --git a/asio/include/asio/detail/impl/win_iocp_io_service.hpp b/asio/include/asio/detail/impl/win_iocp_io_context.hpp similarity index 83% rename from asio/include/asio/detail/impl/win_iocp_io_service.hpp rename to asio/include/asio/detail/impl/win_iocp_io_context.hpp index 9f4a7a6a..f783c30a 100644 --- a/asio/include/asio/detail/impl/win_iocp_io_service.hpp +++ b/asio/include/asio/detail/impl/win_iocp_io_context.hpp @@ -1,5 +1,5 @@ // -// detail/impl/win_iocp_io_service.hpp +// detail/impl/win_iocp_io_context.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) @@ -8,8 +8,8 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef ASIO_DETAIL_IMPL_WIN_IOCP_IO_SERVICE_HPP -#define ASIO_DETAIL_IMPL_WIN_IOCP_IO_SERVICE_HPP +#ifndef ASIO_DETAIL_IMPL_WIN_IOCP_IO_CONTEXT_HPP +#define ASIO_DETAIL_IMPL_WIN_IOCP_IO_CONTEXT_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once @@ -31,21 +31,21 @@ namespace asio { namespace detail { template -void win_iocp_io_service::add_timer_queue( +void win_iocp_io_context::add_timer_queue( timer_queue& queue) { do_add_timer_queue(queue); } template -void win_iocp_io_service::remove_timer_queue( +void win_iocp_io_context::remove_timer_queue( timer_queue& queue) { do_remove_timer_queue(queue); } template -void win_iocp_io_service::schedule_timer(timer_queue& queue, +void win_iocp_io_context::schedule_timer(timer_queue& queue, const typename Time_Traits::time_type& time, typename timer_queue::per_timer_data& timer, wait_op* op) { @@ -65,7 +65,7 @@ void win_iocp_io_service::schedule_timer(timer_queue& queue, } template -std::size_t win_iocp_io_service::cancel_timer(timer_queue& queue, +std::size_t win_iocp_io_context::cancel_timer(timer_queue& queue, typename timer_queue::per_timer_data& timer, std::size_t max_cancelled) { @@ -81,7 +81,7 @@ std::size_t win_iocp_io_service::cancel_timer(timer_queue& queue, } template -void win_iocp_io_service::move_timer(timer_queue& queue, +void win_iocp_io_context::move_timer(timer_queue& queue, typename timer_queue::per_timer_data& to, typename timer_queue::per_timer_data& from) { @@ -100,4 +100,4 @@ void win_iocp_io_service::move_timer(timer_queue& queue, #endif // defined(ASIO_HAS_IOCP) -#endif // ASIO_DETAIL_IMPL_WIN_IOCP_IO_SERVICE_HPP +#endif // ASIO_DETAIL_IMPL_WIN_IOCP_IO_CONTEXT_HPP diff --git a/asio/include/asio/detail/impl/win_iocp_io_service.ipp b/asio/include/asio/detail/impl/win_iocp_io_context.ipp similarity index 87% rename from asio/include/asio/detail/impl/win_iocp_io_service.ipp rename to asio/include/asio/detail/impl/win_iocp_io_context.ipp index 92c67226..6d4ef2fa 100644 --- a/asio/include/asio/detail/impl/win_iocp_io_service.ipp +++ b/asio/include/asio/detail/impl/win_iocp_io_context.ipp @@ -1,5 +1,5 @@ // -// detail/impl/win_iocp_io_service.ipp +// detail/impl/win_iocp_io_context.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) @@ -8,8 +8,8 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef ASIO_DETAIL_IMPL_WIN_IOCP_IO_SERVICE_IPP -#define ASIO_DETAIL_IMPL_WIN_IOCP_IO_SERVICE_IPP +#ifndef ASIO_DETAIL_IMPL_WIN_IOCP_IO_CONTEXT_IPP +#define ASIO_DETAIL_IMPL_WIN_IOCP_IO_CONTEXT_IPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once @@ -25,45 +25,45 @@ #include "asio/detail/handler_invoke_helpers.hpp" #include "asio/detail/limits.hpp" #include "asio/detail/throw_error.hpp" -#include "asio/detail/win_iocp_io_service.hpp" +#include "asio/detail/win_iocp_io_context.hpp" #include "asio/detail/push_options.hpp" namespace asio { namespace detail { -struct win_iocp_io_service::work_finished_on_block_exit +struct win_iocp_io_context::work_finished_on_block_exit { ~work_finished_on_block_exit() { - io_service_->work_finished(); + io_context_->work_finished(); } - win_iocp_io_service* io_service_; + win_iocp_io_context* io_context_; }; -struct win_iocp_io_service::timer_thread_function +struct win_iocp_io_context::timer_thread_function { void operator()() { - while (::InterlockedExchangeAdd(&io_service_->shutdown_, 0) == 0) + while (::InterlockedExchangeAdd(&io_context_->shutdown_, 0) == 0) { - if (::WaitForSingleObject(io_service_->waitable_timer_.handle, + if (::WaitForSingleObject(io_context_->waitable_timer_.handle, INFINITE) == WAIT_OBJECT_0) { - ::InterlockedExchange(&io_service_->dispatch_required_, 1); - ::PostQueuedCompletionStatus(io_service_->iocp_.handle, + ::InterlockedExchange(&io_context_->dispatch_required_, 1); + ::PostQueuedCompletionStatus(io_context_->iocp_.handle, 0, wake_for_dispatch, 0); } } } - win_iocp_io_service* io_service_; + win_iocp_io_context* io_context_; }; -win_iocp_io_service::win_iocp_io_service( +win_iocp_io_context::win_iocp_io_context( asio::execution_context& ctx, size_t concurrency_hint) - : execution_context_service_base(ctx), + : execution_context_service_base(ctx), iocp_(), outstanding_work_(0), stopped_(0), @@ -86,7 +86,7 @@ win_iocp_io_service::win_iocp_io_service( } } -void win_iocp_io_service::shutdown_service() +void win_iocp_io_context::shutdown_service() { ::InterlockedExchange(&shutdown_, 1); @@ -130,7 +130,7 @@ void win_iocp_io_service::shutdown_service() timer_thread_->join(); } -asio::error_code win_iocp_io_service::register_handle( +asio::error_code win_iocp_io_context::register_handle( HANDLE handle, asio::error_code& ec) { if (::CreateIoCompletionPort(handle, iocp_.handle, 0, 0) == 0) @@ -146,7 +146,7 @@ asio::error_code win_iocp_io_service::register_handle( return ec; } -size_t win_iocp_io_service::run(asio::error_code& ec) +size_t win_iocp_io_context::run(asio::error_code& ec) { if (::InterlockedExchangeAdd(&outstanding_work_, 0) == 0) { @@ -165,7 +165,7 @@ size_t win_iocp_io_service::run(asio::error_code& ec) return n; } -size_t win_iocp_io_service::run_one(asio::error_code& ec) +size_t win_iocp_io_context::run_one(asio::error_code& ec) { if (::InterlockedExchangeAdd(&outstanding_work_, 0) == 0) { @@ -180,7 +180,7 @@ size_t win_iocp_io_service::run_one(asio::error_code& ec) return do_one(true, ec); } -size_t win_iocp_io_service::poll(asio::error_code& ec) +size_t win_iocp_io_context::poll(asio::error_code& ec) { if (::InterlockedExchangeAdd(&outstanding_work_, 0) == 0) { @@ -199,7 +199,7 @@ size_t win_iocp_io_service::poll(asio::error_code& ec) return n; } -size_t win_iocp_io_service::poll_one(asio::error_code& ec) +size_t win_iocp_io_context::poll_one(asio::error_code& ec) { if (::InterlockedExchangeAdd(&outstanding_work_, 0) == 0) { @@ -214,7 +214,7 @@ size_t win_iocp_io_service::poll_one(asio::error_code& ec) return do_one(false, ec); } -void win_iocp_io_service::stop() +void win_iocp_io_context::stop() { if (::InterlockedExchange(&stopped_, 1) == 0) { @@ -231,7 +231,7 @@ void win_iocp_io_service::stop() } } -void win_iocp_io_service::post_deferred_completion(win_iocp_operation* op) +void win_iocp_io_context::post_deferred_completion(win_iocp_operation* op) { // Flag the operation as ready. op->ready_ = 1; @@ -246,7 +246,7 @@ void win_iocp_io_service::post_deferred_completion(win_iocp_operation* op) } } -void win_iocp_io_service::post_deferred_completions( +void win_iocp_io_context::post_deferred_completions( op_queue& ops) { while (win_iocp_operation* op = ops.front()) @@ -268,7 +268,7 @@ void win_iocp_io_service::post_deferred_completions( } } -void win_iocp_io_service::abandon_operations( +void win_iocp_io_context::abandon_operations( op_queue& ops) { while (win_iocp_operation* op = ops.front()) @@ -279,7 +279,7 @@ void win_iocp_io_service::abandon_operations( } } -void win_iocp_io_service::on_pending(win_iocp_operation* op) +void win_iocp_io_context::on_pending(win_iocp_operation* op) { if (::InterlockedCompareExchange(&op->ready_, 1, 0) == 1) { @@ -295,7 +295,7 @@ void win_iocp_io_service::on_pending(win_iocp_operation* op) } } -void win_iocp_io_service::on_completion(win_iocp_operation* op, +void win_iocp_io_context::on_completion(win_iocp_operation* op, DWORD last_error, DWORD bytes_transferred) { // Flag that the operation is ready for invocation. @@ -318,7 +318,7 @@ void win_iocp_io_service::on_completion(win_iocp_operation* op, } } -void win_iocp_io_service::on_completion(win_iocp_operation* op, +void win_iocp_io_context::on_completion(win_iocp_operation* op, const asio::error_code& ec, DWORD bytes_transferred) { // Flag that the operation is ready for invocation. @@ -340,7 +340,7 @@ void win_iocp_io_service::on_completion(win_iocp_operation* op, } } -size_t win_iocp_io_service::do_one(bool block, asio::error_code& ec) +size_t win_iocp_io_context::do_one(bool block, asio::error_code& ec) { for (;;) { @@ -454,7 +454,7 @@ size_t win_iocp_io_service::do_one(bool block, asio::error_code& ec) } } -DWORD win_iocp_io_service::get_gqcs_timeout() +DWORD win_iocp_io_context::get_gqcs_timeout() { OSVERSIONINFOEX osvi; ZeroMemory(&osvi, sizeof(osvi)); @@ -470,7 +470,7 @@ DWORD win_iocp_io_service::get_gqcs_timeout() return default_gqcs_timeout; } -void win_iocp_io_service::do_add_timer_queue(timer_queue_base& queue) +void win_iocp_io_context::do_add_timer_queue(timer_queue_base& queue) { mutex::scoped_lock lock(dispatch_mutex_); @@ -501,14 +501,14 @@ void win_iocp_io_service::do_add_timer_queue(timer_queue_base& queue) } } -void win_iocp_io_service::do_remove_timer_queue(timer_queue_base& queue) +void win_iocp_io_context::do_remove_timer_queue(timer_queue_base& queue) { mutex::scoped_lock lock(dispatch_mutex_); timer_queues_.erase(&queue); } -void win_iocp_io_service::update_timeout() +void win_iocp_io_context::update_timeout() { if (timer_thread_.get()) { @@ -534,4 +534,4 @@ void win_iocp_io_service::update_timeout() #endif // defined(ASIO_HAS_IOCP) -#endif // ASIO_DETAIL_IMPL_WIN_IOCP_IO_SERVICE_IPP +#endif // ASIO_DETAIL_IMPL_WIN_IOCP_IO_CONTEXT_IPP diff --git a/asio/include/asio/detail/impl/win_iocp_serial_port_service.ipp b/asio/include/asio/detail/impl/win_iocp_serial_port_service.ipp index 43e46f76..03129f48 100644 --- a/asio/include/asio/detail/impl/win_iocp_serial_port_service.ipp +++ b/asio/include/asio/detail/impl/win_iocp_serial_port_service.ipp @@ -29,8 +29,8 @@ namespace asio { namespace detail { win_iocp_serial_port_service::win_iocp_serial_port_service( - asio::io_service& io_service) - : handle_service_(io_service) + asio::io_context& io_context) + : handle_service_(io_context) { } diff --git a/asio/include/asio/detail/impl/win_iocp_socket_service_base.ipp b/asio/include/asio/detail/impl/win_iocp_socket_service_base.ipp index df3975ab..00b554b1 100644 --- a/asio/include/asio/detail/impl/win_iocp_socket_service_base.ipp +++ b/asio/include/asio/detail/impl/win_iocp_socket_service_base.ipp @@ -27,9 +27,9 @@ namespace asio { namespace detail { win_iocp_socket_service_base::win_iocp_socket_service_base( - asio::io_service& io_service) - : io_service_(io_service), - iocp_service_(use_service(io_service)), + asio::io_context& io_context) + : io_context_(io_context), + iocp_service_(use_service(io_context)), reactor_(0), connect_ex_(0), mutex_(), @@ -663,7 +663,7 @@ select_reactor& win_iocp_socket_service_base::get_reactor() reinterpret_cast(&reactor_), 0, 0)); if (!r) { - r = &(use_service(io_service_)); + r = &(use_service(io_context_)); interlocked_exchange_pointer(reinterpret_cast(&reactor_), r); } return *r; diff --git a/asio/include/asio/detail/impl/win_object_handle_service.ipp b/asio/include/asio/detail/impl/win_object_handle_service.ipp index ccf8f751..0caaad42 100644 --- a/asio/include/asio/detail/impl/win_object_handle_service.ipp +++ b/asio/include/asio/detail/impl/win_object_handle_service.ipp @@ -28,8 +28,8 @@ namespace asio { namespace detail { win_object_handle_service::win_object_handle_service( - asio::io_service& io_service) - : io_service_(asio::use_service(io_service)), + asio::io_context& io_context) + : io_context_(asio::use_service(io_context)), mutex_(), impl_list_(0), shutdown_(false) @@ -51,7 +51,7 @@ void win_object_handle_service::shutdown_service() lock.unlock(); - io_service_.abandon_operations(ops); + io_context_.abandon_operations(ops); } void win_object_handle_service::construct( @@ -177,7 +177,7 @@ void win_object_handle_service::destroy( if (is_open(impl)) { - ASIO_HANDLER_OPERATION((io_service_.context(), "object_handle", + ASIO_HANDLER_OPERATION((io_context_.context(), "object_handle", &impl, reinterpret_cast(impl.wait_handle_), "close")); HANDLE wait_handle = impl.wait_handle_; @@ -202,7 +202,7 @@ void win_object_handle_service::destroy( ::CloseHandle(impl.handle_); impl.handle_ = INVALID_HANDLE_VALUE; - io_service_.post_deferred_completions(ops); + io_context_.post_deferred_completions(ops); } } @@ -227,7 +227,7 @@ asio::error_code win_object_handle_service::close( { if (is_open(impl)) { - ASIO_HANDLER_OPERATION((io_service_.context(), "object_handle", + ASIO_HANDLER_OPERATION((io_context_.context(), "object_handle", &impl, reinterpret_cast(impl.wait_handle_), "close")); mutex::scoped_lock lock(mutex_); @@ -263,7 +263,7 @@ asio::error_code win_object_handle_service::close( asio::error::get_system_category()); } - io_service_.post_deferred_completions(completed_ops); + io_context_.post_deferred_completions(completed_ops); } else { @@ -279,7 +279,7 @@ asio::error_code win_object_handle_service::cancel( { if (is_open(impl)) { - ASIO_HANDLER_OPERATION((io_service_.context(), "object_handle", + ASIO_HANDLER_OPERATION((io_context_.context(), "object_handle", &impl, reinterpret_cast(impl.wait_handle_), "cancel")); mutex::scoped_lock lock(mutex_); @@ -305,7 +305,7 @@ asio::error_code win_object_handle_service::cancel( ec = asio::error_code(); - io_service_.post_deferred_completions(completed_ops); + io_context_.post_deferred_completions(completed_ops); } else { @@ -339,7 +339,7 @@ void win_object_handle_service::wait( void win_object_handle_service::start_wait_op( win_object_handle_service::implementation_type& impl, wait_op* op) { - io_service_.work_started(); + io_context_.work_started(); if (is_open(impl)) { @@ -357,13 +357,13 @@ void win_object_handle_service::start_wait_op( else { lock.unlock(); - io_service_.post_deferred_completion(op); + io_context_.post_deferred_completion(op); } } else { op->ec_ = asio::error::bad_descriptor; - io_service_.post_deferred_completion(op); + io_context_.post_deferred_completion(op); } } @@ -390,7 +390,7 @@ void win_object_handle_service::register_wait_callback( } lock.unlock(); - io_service_.post_deferred_completions(completed_ops); + io_context_.post_deferred_completions(completed_ops); } } @@ -432,9 +432,9 @@ void win_object_handle_service::wait_callback(PVOID param, BOOLEAN) } } - io_service_impl& ios = impl->owner_->io_service_; + io_context_impl& ioc = impl->owner_->io_context_; lock.unlock(); - ios.post_deferred_completions(completed_ops); + ioc.post_deferred_completions(completed_ops); } } diff --git a/asio/include/asio/detail/impl/winrt_ssocket_service_base.ipp b/asio/include/asio/detail/impl/winrt_ssocket_service_base.ipp index 06507004..c6cedea2 100644 --- a/asio/include/asio/detail/impl/winrt_ssocket_service_base.ipp +++ b/asio/include/asio/detail/impl/winrt_ssocket_service_base.ipp @@ -30,9 +30,9 @@ namespace asio { namespace detail { winrt_ssocket_service_base::winrt_ssocket_service_base( - asio::io_service& io_service) - : io_service_(use_service(io_service)), - async_manager_(use_service(io_service)), + asio::io_context& io_context) + : io_context_(use_service(io_context)), + async_manager_(use_service(io_context)), mutex_(), impl_list_(0) { @@ -381,7 +381,7 @@ void winrt_ssocket_service_base::start_connect_op( if (!is_open(impl)) { op->ec_ = asio::error::bad_descriptor; - io_service_.post_immediate_completion(op, is_continuation); + io_context_.post_immediate_completion(op, is_continuation); return; } @@ -410,7 +410,7 @@ void winrt_ssocket_service_base::start_connect_op( if (op->ec_) { - io_service_.post_immediate_completion(op, is_continuation); + io_context_.post_immediate_completion(op, is_continuation); return; } @@ -425,7 +425,7 @@ void winrt_ssocket_service_base::start_connect_op( { op->ec_ = asio::error_code( e->HResult, asio::system_category()); - io_service_.post_immediate_completion(op, is_continuation); + io_context_.post_immediate_completion(op, is_continuation); } } @@ -476,14 +476,14 @@ void winrt_ssocket_service_base::start_send_op( if (flags) { op->ec_ = asio::error::operation_not_supported; - io_service_.post_immediate_completion(op, is_continuation); + io_context_.post_immediate_completion(op, is_continuation); return; } if (!is_open(impl)) { op->ec_ = asio::error::bad_descriptor; - io_service_.post_immediate_completion(op, is_continuation); + io_context_.post_immediate_completion(op, is_continuation); return; } @@ -494,7 +494,7 @@ void winrt_ssocket_service_base::start_send_op( if (bufs.all_empty()) { - io_service_.post_immediate_completion(op, is_continuation); + io_context_.post_immediate_completion(op, is_continuation); return; } @@ -505,7 +505,7 @@ void winrt_ssocket_service_base::start_send_op( { op->ec_ = asio::error_code(e->HResult, asio::system_category()); - io_service_.post_immediate_completion(op, is_continuation); + io_context_.post_immediate_completion(op, is_continuation); } } @@ -567,14 +567,14 @@ void winrt_ssocket_service_base::start_receive_op( if (flags) { op->ec_ = asio::error::operation_not_supported; - io_service_.post_immediate_completion(op, is_continuation); + io_context_.post_immediate_completion(op, is_continuation); return; } if (!is_open(impl)) { op->ec_ = asio::error::bad_descriptor; - io_service_.post_immediate_completion(op, is_continuation); + io_context_.post_immediate_completion(op, is_continuation); return; } @@ -585,7 +585,7 @@ void winrt_ssocket_service_base::start_receive_op( if (bufs.all_empty()) { - io_service_.post_immediate_completion(op, is_continuation); + io_context_.post_immediate_completion(op, is_continuation); return; } @@ -598,7 +598,7 @@ void winrt_ssocket_service_base::start_receive_op( { op->ec_ = asio::error_code(e->HResult, asio::system_category()); - io_service_.post_immediate_completion(op, is_continuation); + io_context_.post_immediate_completion(op, is_continuation); } } diff --git a/asio/include/asio/detail/impl/winrt_timer_scheduler.hpp b/asio/include/asio/detail/impl/winrt_timer_scheduler.hpp index 1ed26d6b..1ec1ccbf 100644 --- a/asio/include/asio/detail/impl/winrt_timer_scheduler.hpp +++ b/asio/include/asio/detail/impl/winrt_timer_scheduler.hpp @@ -46,12 +46,12 @@ void winrt_timer_scheduler::schedule_timer(timer_queue& queue, if (shutdown_) { - io_service_.post_immediate_completion(op, false); + io_context_.post_immediate_completion(op, false); return; } bool earliest = queue.enqueue_timer(time, timer, op); - io_service_.work_started(); + io_context_.work_started(); if (earliest) event_.signal(lock); } @@ -65,7 +65,7 @@ std::size_t winrt_timer_scheduler::cancel_timer(timer_queue& queue, op_queue ops; std::size_t n = queue.cancel_timer(timer, ops, max_cancelled); lock.unlock(); - io_service_.post_deferred_completions(ops); + io_context_.post_deferred_completions(ops); return n; } diff --git a/asio/include/asio/detail/impl/winrt_timer_scheduler.ipp b/asio/include/asio/detail/impl/winrt_timer_scheduler.ipp index 77389173..97eaa7d9 100644 --- a/asio/include/asio/detail/impl/winrt_timer_scheduler.ipp +++ b/asio/include/asio/detail/impl/winrt_timer_scheduler.ipp @@ -28,9 +28,9 @@ namespace asio { namespace detail { winrt_timer_scheduler::winrt_timer_scheduler( - asio::io_service& io_service) - : asio::detail::service_base(io_service), - io_service_(use_service(io_service)), + asio::io_context& io_context) + : asio::detail::service_base(io_context), + io_context_(use_service(io_context)), mutex_(), event_(), timer_queues_(), @@ -64,10 +64,10 @@ void winrt_timer_scheduler::shutdown_service() op_queue ops; timer_queues_.get_all_timers(ops); - io_service_.abandon_operations(ops); + io_context_.abandon_operations(ops); } -void winrt_timer_scheduler::fork_service(asio::io_service::fork_event) +void winrt_timer_scheduler::fork_service(asio::io_context::fork_event) { } @@ -89,7 +89,7 @@ void winrt_timer_scheduler::run_thread() if (!ops.empty()) { lock.unlock(); - io_service_.post_deferred_completions(ops); + io_context_.post_deferred_completions(ops); lock.lock(); } } diff --git a/asio/include/asio/detail/null_socket_service.hpp b/asio/include/asio/detail/null_socket_service.hpp index c991720e..706f0a3d 100644 --- a/asio/include/asio/detail/null_socket_service.hpp +++ b/asio/include/asio/detail/null_socket_service.hpp @@ -21,7 +21,7 @@ #include "asio/buffer.hpp" #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/socket_base.hpp" #include "asio/detail/bind_handler.hpp" @@ -49,8 +49,8 @@ public: }; // Constructor. - null_socket_service(asio::io_service& io_service) - : io_service_(io_service) + null_socket_service(asio::io_context& io_context) + : io_context_(io_context) { } @@ -267,7 +267,7 @@ public: { asio::error_code ec = asio::error::operation_not_supported; const std::size_t bytes_transferred = 0; - io_service_.post(detail::bind_handler(handler, ec, bytes_transferred)); + io_context_.post(detail::bind_handler(handler, ec, bytes_transferred)); } // Start an asynchronous wait until data can be sent without blocking. @@ -277,7 +277,7 @@ public: { asio::error_code ec = asio::error::operation_not_supported; const std::size_t bytes_transferred = 0; - io_service_.post(detail::bind_handler(handler, ec, bytes_transferred)); + io_context_.post(detail::bind_handler(handler, ec, bytes_transferred)); } // Receive some data from the peer. Returns the number of bytes received. @@ -305,7 +305,7 @@ public: { asio::error_code ec = asio::error::operation_not_supported; const std::size_t bytes_transferred = 0; - io_service_.post(detail::bind_handler(handler, ec, bytes_transferred)); + io_context_.post(detail::bind_handler(handler, ec, bytes_transferred)); } // Wait until data can be received without blocking. @@ -315,7 +315,7 @@ public: { asio::error_code ec = asio::error::operation_not_supported; const std::size_t bytes_transferred = 0; - io_service_.post(detail::bind_handler(handler, ec, bytes_transferred)); + io_context_.post(detail::bind_handler(handler, ec, bytes_transferred)); } // Receive some data with associated flags. Returns the number of bytes @@ -347,7 +347,7 @@ public: { asio::error_code ec = asio::error::operation_not_supported; const std::size_t bytes_transferred = 0; - io_service_.post(detail::bind_handler(handler, ec, bytes_transferred)); + io_context_.post(detail::bind_handler(handler, ec, bytes_transferred)); } // Wait until data can be received without blocking. @@ -358,7 +358,7 @@ public: { asio::error_code ec = asio::error::operation_not_supported; const std::size_t bytes_transferred = 0; - io_service_.post(detail::bind_handler(handler, ec, bytes_transferred)); + io_context_.post(detail::bind_handler(handler, ec, bytes_transferred)); } // Send a datagram to the specified endpoint. Returns the number of bytes @@ -390,7 +390,7 @@ public: { asio::error_code ec = asio::error::operation_not_supported; const std::size_t bytes_transferred = 0; - io_service_.post(detail::bind_handler(handler, ec, bytes_transferred)); + io_context_.post(detail::bind_handler(handler, ec, bytes_transferred)); } // Start an asynchronous wait until data can be sent without blocking. @@ -400,7 +400,7 @@ public: { asio::error_code ec = asio::error::operation_not_supported; const std::size_t bytes_transferred = 0; - io_service_.post(detail::bind_handler(handler, ec, bytes_transferred)); + io_context_.post(detail::bind_handler(handler, ec, bytes_transferred)); } // Receive a datagram with the endpoint of the sender. Returns the number of @@ -433,7 +433,7 @@ public: { asio::error_code ec = asio::error::operation_not_supported; const std::size_t bytes_transferred = 0; - io_service_.post(detail::bind_handler(handler, ec, bytes_transferred)); + io_context_.post(detail::bind_handler(handler, ec, bytes_transferred)); } // Wait until data can be received without blocking. @@ -444,7 +444,7 @@ public: { asio::error_code ec = asio::error::operation_not_supported; const std::size_t bytes_transferred = 0; - io_service_.post(detail::bind_handler(handler, ec, bytes_transferred)); + io_context_.post(detail::bind_handler(handler, ec, bytes_transferred)); } // Accept a new connection. @@ -463,7 +463,7 @@ public: endpoint_type*, Handler& handler) { asio::error_code ec = asio::error::operation_not_supported; - io_service_.post(detail::bind_handler(handler, ec)); + io_context_.post(detail::bind_handler(handler, ec)); } // Connect the socket to the specified endpoint. @@ -480,11 +480,11 @@ public: const endpoint_type&, Handler& handler) { asio::error_code ec = asio::error::operation_not_supported; - io_service_.post(detail::bind_handler(handler, ec)); + io_context_.post(detail::bind_handler(handler, ec)); } private: - asio::io_service& io_service_; + asio::io_context& io_context_; }; } // namespace detail diff --git a/asio/include/asio/detail/reactive_descriptor_service.hpp b/asio/include/asio/detail/reactive_descriptor_service.hpp index 6f5c71d1..671a1b53 100644 --- a/asio/include/asio/detail/reactive_descriptor_service.hpp +++ b/asio/include/asio/detail/reactive_descriptor_service.hpp @@ -22,7 +22,7 @@ && !defined(__CYGWIN__) #include "asio/buffer.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/detail/bind_handler.hpp" #include "asio/detail/buffer_sequence_adapter.hpp" #include "asio/detail/descriptor_ops.hpp" @@ -75,7 +75,7 @@ public: // Constructor. ASIO_DECL reactive_descriptor_service( - asio::io_service& io_service); + asio::io_context& io_context); // Destroy all user-defined handler objects owned by the service. ASIO_DECL void shutdown_service(); diff --git a/asio/include/asio/detail/reactive_serial_port_service.hpp b/asio/include/asio/detail/reactive_serial_port_service.hpp index efac78ed..01a58323 100644 --- a/asio/include/asio/detail/reactive_serial_port_service.hpp +++ b/asio/include/asio/detail/reactive_serial_port_service.hpp @@ -23,7 +23,7 @@ #include #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/serial_port_base.hpp" #include "asio/detail/descriptor_ops.hpp" #include "asio/detail/reactive_descriptor_service.hpp" @@ -44,7 +44,7 @@ public: typedef reactive_descriptor_service::implementation_type implementation_type; ASIO_DECL reactive_serial_port_service( - asio::io_service& io_service); + asio::io_context& io_context); // Destroy all user-defined handler objects owned by the service. ASIO_DECL void shutdown_service(); diff --git a/asio/include/asio/detail/reactive_socket_accept_op.hpp b/asio/include/asio/detail/reactive_socket_accept_op.hpp index f71954e2..fa4e8dbf 100644 --- a/asio/include/asio/detail/reactive_socket_accept_op.hpp +++ b/asio/include/asio/detail/reactive_socket_accept_op.hpp @@ -142,10 +142,10 @@ class reactive_socket_move_accept_op : public: ASIO_DEFINE_HANDLER_PTR(reactive_socket_move_accept_op); - reactive_socket_move_accept_op(io_service& ios, socket_type socket, + reactive_socket_move_accept_op(io_context& ioc, socket_type socket, socket_ops::state_type state, const Protocol& protocol, typename Protocol::endpoint* peer_endpoint, Handler& handler) - : Protocol::socket(ios), + : Protocol::socket(ioc), reactive_socket_accept_op_base( socket, state, *this, protocol, peer_endpoint, &reactive_socket_move_accept_op::do_complete), diff --git a/asio/include/asio/detail/reactive_socket_service.hpp b/asio/include/asio/detail/reactive_socket_service.hpp index 650a999a..79949523 100644 --- a/asio/include/asio/detail/reactive_socket_service.hpp +++ b/asio/include/asio/detail/reactive_socket_service.hpp @@ -21,7 +21,7 @@ #include "asio/buffer.hpp" #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/socket_base.hpp" #include "asio/detail/buffer_sequence_adapter.hpp" #include "asio/detail/memory.hpp" @@ -72,8 +72,8 @@ public: }; // Constructor. - reactive_socket_service(asio::io_service& io_service) - : reactive_socket_service_base(io_service) + reactive_socket_service(asio::io_context& io_context) + : reactive_socket_service_base(io_context) { } @@ -392,11 +392,11 @@ public: #if defined(ASIO_HAS_MOVE) // Accept a new connection. typename Protocol::socket accept(implementation_type& impl, - io_service* peer_io_service, endpoint_type* peer_endpoint, + io_context* peer_io_context, endpoint_type* peer_endpoint, asio::error_code& ec) { typename Protocol::socket peer( - peer_io_service ? *peer_io_service : io_service_); + peer_io_context ? *peer_io_context : io_context_); std::size_t addr_len = peer_endpoint ? peer_endpoint->capacity() : 0; socket_holder new_socket(socket_ops::sync_accept(impl.socket_, @@ -444,7 +444,7 @@ public: // the accept's handler is invoked. template void async_accept(implementation_type& impl, - asio::io_service* peer_io_service, + asio::io_context* peer_io_context, endpoint_type* peer_endpoint, Handler& handler) { bool is_continuation = @@ -454,7 +454,7 @@ public: typedef reactive_socket_move_accept_op op; typename op::ptr p = { asio::detail::addressof(handler), op::ptr::allocate(handler), 0 }; - p.p = new (p.v) op(peer_io_service ? *peer_io_service : io_service_, + p.p = new (p.v) op(peer_io_context ? *peer_io_context : io_context_, impl.socket_, impl.state_, impl.protocol_, peer_endpoint, handler); ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket", diff --git a/asio/include/asio/detail/reactive_socket_service_base.hpp b/asio/include/asio/detail/reactive_socket_service_base.hpp index 92c5525e..04d95a28 100644 --- a/asio/include/asio/detail/reactive_socket_service_base.hpp +++ b/asio/include/asio/detail/reactive_socket_service_base.hpp @@ -22,7 +22,7 @@ #include "asio/buffer.hpp" #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/socket_base.hpp" #include "asio/detail/buffer_sequence_adapter.hpp" #include "asio/detail/memory.hpp" @@ -63,7 +63,7 @@ public: // Constructor. ASIO_DECL reactive_socket_service_base( - asio::io_service& io_service); + asio::io_context& io_context); // Destroy all user-defined handler objects owned by the service. ASIO_DECL void shutdown_service(); @@ -493,8 +493,8 @@ protected: reactor_op* op, bool is_continuation, const socket_addr_type* addr, size_t addrlen); - // The io_service that owns this socket service. - io_service& io_service_; + // The io_context that owns this socket service. + io_context& io_context_; // The selector that performs event demultiplexing for the service. reactor& reactor_; diff --git a/asio/include/asio/detail/resolve_endpoint_op.hpp b/asio/include/asio/detail/resolve_endpoint_op.hpp index b09c65a1..cee29e04 100644 --- a/asio/include/asio/detail/resolve_endpoint_op.hpp +++ b/asio/include/asio/detail/resolve_endpoint_op.hpp @@ -17,7 +17,7 @@ #include "asio/detail/config.hpp" #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/ip/basic_resolver_results.hpp" #include "asio/detail/bind_handler.hpp" #include "asio/detail/fenced_block.hpp" @@ -42,11 +42,11 @@ public: typedef asio::ip::basic_resolver_results results_type; resolve_endpoint_op(socket_ops::weak_cancel_token_type cancel_token, - const endpoint_type& endpoint, io_service_impl& ios, Handler& handler) + const endpoint_type& endpoint, io_context_impl& ioc, Handler& handler) : operation(&resolve_endpoint_op::do_complete), cancel_token_(cancel_token), endpoint_(endpoint), - io_service_impl_(ios), + io_context_impl_(ioc), handler_(ASIO_MOVE_CAST(Handler)(handler)) { handler_work::start(handler_); @@ -61,9 +61,9 @@ public: ptr p = { asio::detail::addressof(o->handler_), o, o }; handler_work w(o->handler_); - if (owner && owner != &o->io_service_impl_) + if (owner && owner != &o->io_context_impl_) { - // The operation is being run on the worker io_service. Time to perform + // The operation is being run on the worker io_context. Time to perform // the resolver operation. // Perform the blocking endpoint resolution operation. @@ -74,13 +74,13 @@ public: o->endpoint_.protocol().type(), o->ec_); o->results_ = results_type::create(o->endpoint_, host_name, service_name); - // Pass operation back to main io_service for completion. - o->io_service_impl_.post_deferred_completion(o); + // Pass operation back to main io_context for completion. + o->io_context_impl_.post_deferred_completion(o); p.v = p.p = 0; } else { - // The operation has been returned to the main io_service. The completion + // The operation has been returned to the main io_context. The completion // handler is ready to be delivered. ASIO_HANDLER_COMPLETION((*o)); @@ -109,7 +109,7 @@ public: private: socket_ops::weak_cancel_token_type cancel_token_; endpoint_type endpoint_; - io_service_impl& io_service_impl_; + io_context_impl& io_context_impl_; Handler handler_; asio::error_code ec_; results_type results_; diff --git a/asio/include/asio/detail/resolve_op.hpp b/asio/include/asio/detail/resolve_op.hpp index 3776499c..67513680 100644 --- a/asio/include/asio/detail/resolve_op.hpp +++ b/asio/include/asio/detail/resolve_op.hpp @@ -17,7 +17,7 @@ #include "asio/detail/config.hpp" #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/ip/basic_resolver_query.hpp" #include "asio/ip/basic_resolver_results.hpp" #include "asio/detail/bind_handler.hpp" @@ -43,11 +43,11 @@ public: typedef asio::ip::basic_resolver_results results_type; resolve_op(socket_ops::weak_cancel_token_type cancel_token, - const query_type& query, io_service_impl& ios, Handler& handler) + const query_type& query, io_context_impl& ioc, Handler& handler) : operation(&resolve_op::do_complete), cancel_token_(cancel_token), query_(query), - io_service_impl_(ios), + io_context_impl_(ioc), handler_(ASIO_MOVE_CAST(Handler)(handler)), addrinfo_(0) { @@ -69,9 +69,9 @@ public: ptr p = { asio::detail::addressof(o->handler_), o, o }; handler_work w(o->handler_); - if (owner && owner != &o->io_service_impl_) + if (owner && owner != &o->io_context_impl_) { - // The operation is being run on the worker io_service. Time to perform + // The operation is being run on the worker io_context. Time to perform // the resolver operation. // Perform the blocking host resolution operation. @@ -79,13 +79,13 @@ public: o->query_.host_name().c_str(), o->query_.service_name().c_str(), o->query_.hints(), &o->addrinfo_, o->ec_); - // Pass operation back to main io_service for completion. - o->io_service_impl_.post_deferred_completion(o); + // Pass operation back to main io_context for completion. + o->io_context_impl_.post_deferred_completion(o); p.v = p.p = 0; } else { - // The operation has been returned to the main io_service. The completion + // The operation has been returned to the main io_context. The completion // handler is ready to be delivered. ASIO_HANDLER_COMPLETION((*o)); @@ -119,7 +119,7 @@ public: private: socket_ops::weak_cancel_token_type cancel_token_; query_type query_; - io_service_impl& io_service_impl_; + io_context_impl& io_context_impl_; Handler handler_; asio::error_code ec_; asio::detail::addrinfo_type* addrinfo_; diff --git a/asio/include/asio/detail/resolver_service.hpp b/asio/include/asio/detail/resolver_service.hpp index d27c1c09..f1fc2b06 100644 --- a/asio/include/asio/detail/resolver_service.hpp +++ b/asio/include/asio/detail/resolver_service.hpp @@ -49,8 +49,8 @@ public: typedef asio::ip::basic_resolver_results results_type; // Constructor. - resolver_service(asio::io_service& io_service) - : resolver_service_base(io_service) + resolver_service(asio::io_context& io_context) + : resolver_service_base(io_context) { } @@ -77,9 +77,9 @@ public: typedef resolve_op op; typename op::ptr p = { asio::detail::addressof(handler), op::ptr::allocate(handler), 0 }; - p.p = new (p.v) op(impl, query, io_service_impl_, handler); + p.p = new (p.v) op(impl, query, io_context_impl_, handler); - ASIO_HANDLER_CREATION((io_service_impl_.context(), + ASIO_HANDLER_CREATION((io_context_impl_.context(), *p.p, "resolver", &impl, 0, "async_resolve")); start_resolve_op(p.p); @@ -109,9 +109,9 @@ public: typedef resolve_endpoint_op op; typename op::ptr p = { asio::detail::addressof(handler), op::ptr::allocate(handler), 0 }; - p.p = new (p.v) op(impl, endpoint, io_service_impl_, handler); + p.p = new (p.v) op(impl, endpoint, io_context_impl_, handler); - ASIO_HANDLER_CREATION((io_service_impl_.context(), + ASIO_HANDLER_CREATION((io_context_impl_.context(), *p.p, "resolver", &impl, 0, "async_resolve")); start_resolve_op(p.p); diff --git a/asio/include/asio/detail/resolver_service_base.hpp b/asio/include/asio/detail/resolver_service_base.hpp index 221ae91a..80ae121c 100644 --- a/asio/include/asio/detail/resolver_service_base.hpp +++ b/asio/include/asio/detail/resolver_service_base.hpp @@ -17,7 +17,7 @@ #include "asio/detail/config.hpp" #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/detail/mutex.hpp" #include "asio/detail/noncopyable.hpp" #include "asio/detail/operation.hpp" @@ -39,7 +39,7 @@ public: typedef socket_ops::shared_cancel_token_type implementation_type; // Constructor. - ASIO_DECL resolver_service_base(asio::io_service& io_service); + ASIO_DECL resolver_service_base(asio::io_context& io_context); // Destructor. ASIO_DECL ~resolver_service_base(); @@ -49,7 +49,7 @@ public: // Perform any fork-related housekeeping. ASIO_DECL void fork_service( - asio::io_service::fork_event fork_ev); + asio::io_context::fork_event fork_ev); // Construct a new resolver implementation. ASIO_DECL void construct(implementation_type& impl); @@ -91,29 +91,29 @@ protected: }; #endif // !defined(ASIO_WINDOWS_RUNTIME) - // Helper class to run the work io_service in a thread. - class work_io_service_runner; + // Helper class to run the work io_context in a thread. + class work_io_context_runner; // Start the work thread if it's not already running. ASIO_DECL void start_work_thread(); - // The io_service implementation used to post completions. - io_service_impl& io_service_impl_; + // The io_context implementation used to post completions. + io_context_impl& io_context_impl_; private: // Mutex to protect access to internal data. asio::detail::mutex mutex_; - // Private io_service used for performing asynchronous host resolution. - asio::detail::scoped_ptr work_io_service_; + // Private io_context used for performing asynchronous host resolution. + asio::detail::scoped_ptr work_io_context_; - // The work io_service implementation used to post completions. - io_service_impl& work_io_service_impl_; + // The work io_context implementation used to post completions. + io_context_impl& work_io_context_impl_; - // Work for the private io_service to perform. - asio::detail::scoped_ptr work_; + // Work for the private io_context to perform. + asio::detail::scoped_ptr work_; - // Thread used for running the work io_service's run loop. + // Thread used for running the work io_context's run loop. asio::detail::scoped_ptr work_thread_; }; diff --git a/asio/include/asio/detail/select_reactor.hpp b/asio/include/asio/detail/select_reactor.hpp index 183db2b9..3021775d 100644 --- a/asio/include/asio/detail/select_reactor.hpp +++ b/asio/include/asio/detail/select_reactor.hpp @@ -175,7 +175,7 @@ private: // The scheduler implementation used to post completions. # if defined(ASIO_HAS_IOCP) - typedef class win_iocp_io_service scheduler_type; + typedef class win_iocp_io_context scheduler_type; # else // defined(ASIO_HAS_IOCP) typedef class scheduler scheduler_type; # endif // defined(ASIO_HAS_IOCP) diff --git a/asio/include/asio/detail/service_registry.hpp b/asio/include/asio/detail/service_registry.hpp index 1bf72337..77af51b1 100644 --- a/asio/include/asio/detail/service_registry.hpp +++ b/asio/include/asio/detail/service_registry.hpp @@ -25,7 +25,7 @@ namespace asio { -class io_service; +class io_context; namespace detail { @@ -61,9 +61,9 @@ public: // create a new service object automatically if no such object already // exists. Ownership of the service object is not transferred to the caller. // This overload is used for backwards compatibility with services that - // inherit from io_service::service. + // inherit from io_context::service. template - Service& use_service(io_service& owner); + Service& use_service(io_context& owner); // Add a service object. Throws on error, in which case ownership of the // object is retained by the caller. diff --git a/asio/include/asio/detail/signal_set_service.hpp b/asio/include/asio/detail/signal_set_service.hpp index b726dba8..d25d474b 100644 --- a/asio/include/asio/detail/signal_set_service.hpp +++ b/asio/include/asio/detail/signal_set_service.hpp @@ -20,7 +20,7 @@ #include #include #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/detail/handler_alloc_helpers.hpp" #include "asio/detail/memory.hpp" #include "asio/detail/op_queue.hpp" @@ -108,7 +108,7 @@ public: }; // Constructor. - ASIO_DECL signal_set_service(asio::io_service& io_service); + ASIO_DECL signal_set_service(asio::io_context& io_context); // Destructor. ASIO_DECL ~signal_set_service(); @@ -118,7 +118,7 @@ public: // Perform fork-related housekeeping. ASIO_DECL void fork_service( - asio::io_service::fork_event fork_ev); + asio::io_context::fork_event fork_ev); // Construct a new signal_set implementation. ASIO_DECL void construct(implementation_type& impl); @@ -152,7 +152,7 @@ public: op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(handler); - ASIO_HANDLER_CREATION((io_service_.context(), + ASIO_HANDLER_CREATION((io_context_.context(), *p.p, "signal_set", &impl, 0, "async_wait")); start_wait_op(impl, p.p); @@ -178,8 +178,8 @@ private: // Helper function to start a wait operation. ASIO_DECL void start_wait_op(implementation_type& impl, signal_op* op); - // The io_service instance used for dispatching handlers. - io_service_impl& io_service_; + // The io_context instance used for dispatching handlers. + io_context_impl& io_context_; #if !defined(ASIO_WINDOWS) \ && !defined(ASIO_WINDOWS_RUNTIME) \ diff --git a/asio/include/asio/detail/strand_service.hpp b/asio/include/asio/detail/strand_service.hpp index 7b4bc8ac..84ec68a5 100644 --- a/asio/include/asio/detail/strand_service.hpp +++ b/asio/include/asio/detail/strand_service.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/detail/mutex.hpp" #include "asio/detail/op_queue.hpp" #include "asio/detail/operation.hpp" @@ -74,8 +74,8 @@ public: typedef strand_impl* implementation_type; - // Construct a new strand service for the specified io_service. - ASIO_DECL explicit strand_service(asio::io_service& io_service); + // Construct a new strand service for the specified io_context. + ASIO_DECL explicit strand_service(asio::io_context& io_context); // Destroy all user-defined handler objects owned by the service. ASIO_DECL void shutdown_service(); @@ -83,11 +83,11 @@ public: // Construct a new strand implementation. ASIO_DECL void construct(implementation_type& impl); - // Request the io_service to invoke the given handler. + // Request the io_context to invoke the given handler. template void dispatch(implementation_type& impl, Handler& handler); - // Request the io_service to invoke the given handler and return immediately. + // Request the io_context to invoke the given handler and return immediately. template void post(implementation_type& impl, Handler& handler); @@ -108,8 +108,8 @@ private: operation* base, const asio::error_code& ec, std::size_t bytes_transferred); - // The io_service implementation used to post completions. - io_service_impl& io_service_; + // The io_context implementation used to post completions. + io_context_impl& io_context_; // Mutex to protect access to the array of implementations. asio::detail::mutex mutex_; diff --git a/asio/include/asio/detail/thread_context.hpp b/asio/include/asio/detail/thread_context.hpp index 0cbf343f..9ad6034c 100644 --- a/asio/include/asio/detail/thread_context.hpp +++ b/asio/include/asio/detail/thread_context.hpp @@ -26,7 +26,7 @@ namespace detail { class thread_info_base; -// Base class for things that manage threads (scheduler, win_iocp_io_service). +// Base class for things that manage threads (scheduler, win_iocp_io_context). class thread_context { public: diff --git a/asio/include/asio/detail/timer_scheduler.hpp b/asio/include/asio/detail/timer_scheduler.hpp index 34f82596..3e6a65e4 100644 --- a/asio/include/asio/detail/timer_scheduler.hpp +++ b/asio/include/asio/detail/timer_scheduler.hpp @@ -21,7 +21,7 @@ #if defined(ASIO_WINDOWS_RUNTIME) # include "asio/detail/winrt_timer_scheduler.hpp" #elif defined(ASIO_HAS_IOCP) -# include "asio/detail/win_iocp_io_service.hpp" +# include "asio/detail/win_iocp_io_context.hpp" #elif defined(ASIO_HAS_EPOLL) # include "asio/detail/epoll_reactor.hpp" #elif defined(ASIO_HAS_KQUEUE) diff --git a/asio/include/asio/detail/timer_scheduler_fwd.hpp b/asio/include/asio/detail/timer_scheduler_fwd.hpp index 69b0586b..897c3cf1 100644 --- a/asio/include/asio/detail/timer_scheduler_fwd.hpp +++ b/asio/include/asio/detail/timer_scheduler_fwd.hpp @@ -23,7 +23,7 @@ namespace detail { #if defined(ASIO_WINDOWS_RUNTIME) typedef class winrt_timer_scheduler timer_scheduler; #elif defined(ASIO_HAS_IOCP) -typedef class win_iocp_io_service timer_scheduler; +typedef class win_iocp_io_context timer_scheduler; #elif defined(ASIO_HAS_EPOLL) typedef class epoll_reactor timer_scheduler; #elif defined(ASIO_HAS_KQUEUE) diff --git a/asio/include/asio/detail/wait_handler.hpp b/asio/include/asio/detail/wait_handler.hpp index 0eb4eb78..7cda7742 100644 --- a/asio/include/asio/detail/wait_handler.hpp +++ b/asio/include/asio/detail/wait_handler.hpp @@ -21,7 +21,7 @@ #include "asio/detail/handler_invoke_helpers.hpp" #include "asio/detail/memory.hpp" #include "asio/detail/wait_op.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/detail/push_options.hpp" diff --git a/asio/include/asio/detail/win_iocp_handle_service.hpp b/asio/include/asio/detail/win_iocp_handle_service.hpp index d052e182..4b8257c5 100644 --- a/asio/include/asio/detail/win_iocp_handle_service.hpp +++ b/asio/include/asio/detail/win_iocp_handle_service.hpp @@ -21,7 +21,7 @@ #if defined(ASIO_HAS_IOCP) #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/detail/buffer_sequence_adapter.hpp" #include "asio/detail/cstdint.hpp" #include "asio/detail/handler_alloc_helpers.hpp" @@ -30,7 +30,7 @@ #include "asio/detail/operation.hpp" #include "asio/detail/win_iocp_handle_read_op.hpp" #include "asio/detail/win_iocp_handle_write_op.hpp" -#include "asio/detail/win_iocp_io_service.hpp" +#include "asio/detail/win_iocp_io_context.hpp" #include "asio/detail/push_options.hpp" @@ -74,7 +74,7 @@ public: implementation_type* prev_; }; - ASIO_DECL win_iocp_handle_service(asio::io_service& io_service); + ASIO_DECL win_iocp_handle_service(asio::io_context& io_context); // Destroy all user-defined handler objects owned by the service. ASIO_DECL void shutdown_service(); @@ -299,7 +299,7 @@ private: // The IOCP service used for running asynchronous operations and dispatching // handlers. - win_iocp_io_service& iocp_service_; + win_iocp_io_context& iocp_service_; // Mutex to protect access to the linked list of implementations. mutex mutex_; diff --git a/asio/include/asio/detail/win_iocp_io_service.hpp b/asio/include/asio/detail/win_iocp_io_context.hpp similarity index 95% rename from asio/include/asio/detail/win_iocp_io_service.hpp rename to asio/include/asio/detail/win_iocp_io_context.hpp index cb696235..6f151cbd 100644 --- a/asio/include/asio/detail/win_iocp_io_service.hpp +++ b/asio/include/asio/detail/win_iocp_io_context.hpp @@ -1,5 +1,5 @@ // -// detail/win_iocp_io_service.hpp +// detail/win_iocp_io_context.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) @@ -8,8 +8,8 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef ASIO_DETAIL_WIN_IOCP_IO_SERVICE_HPP -#define ASIO_DETAIL_WIN_IOCP_IO_SERVICE_HPP +#ifndef ASIO_DETAIL_WIN_IOCP_IO_CONTEXT_HPP +#define ASIO_DETAIL_WIN_IOCP_IO_CONTEXT_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once @@ -40,14 +40,14 @@ namespace detail { class wait_op; -class win_iocp_io_service - : public execution_context_service_base, +class win_iocp_io_context + : public execution_context_service_base, public thread_context { public: // Constructor. Specifies a concurrency hint that is passed through to the // underlying I/O completion port. - ASIO_DECL win_iocp_io_service(asio::execution_context& ctx, + ASIO_DECL win_iocp_io_context(asio::execution_context& ctx, size_t concurrency_hint = 0); // Destroy all user-defined handler objects owned by the service. @@ -77,7 +77,7 @@ public: // Stop the event processing loop. ASIO_DECL void stop(); - // Determine whether the io_service is stopped. + // Determine whether the io_context is stopped. bool stopped() const { return ::InterlockedExchangeAdd(&stopped_, 0) != 0; @@ -306,11 +306,11 @@ private: #include "asio/detail/pop_options.hpp" -#include "asio/detail/impl/win_iocp_io_service.hpp" +#include "asio/detail/impl/win_iocp_io_context.hpp" #if defined(ASIO_HEADER_ONLY) -# include "asio/detail/impl/win_iocp_io_service.ipp" +# include "asio/detail/impl/win_iocp_io_context.ipp" #endif // defined(ASIO_HEADER_ONLY) #endif // defined(ASIO_HAS_IOCP) -#endif // ASIO_DETAIL_WIN_IOCP_IO_SERVICE_HPP +#endif // ASIO_DETAIL_WIN_IOCP_IO_CONTEXT_HPP diff --git a/asio/include/asio/detail/win_iocp_operation.hpp b/asio/include/asio/detail/win_iocp_operation.hpp index 95a6877c..8d9ffd33 100644 --- a/asio/include/asio/detail/win_iocp_operation.hpp +++ b/asio/include/asio/detail/win_iocp_operation.hpp @@ -29,7 +29,7 @@ namespace asio { namespace detail { -class win_iocp_io_service; +class win_iocp_io_context; // Base class for all operations. A function pointer is used instead of virtual // functions to avoid the associated overhead. @@ -80,7 +80,7 @@ protected: private: friend class op_queue_access; - friend class win_iocp_io_service; + friend class win_iocp_io_context; win_iocp_operation* next_; func_type func_; long ready_; diff --git a/asio/include/asio/detail/win_iocp_overlapped_ptr.hpp b/asio/include/asio/detail/win_iocp_overlapped_ptr.hpp index 9bd47999..62c3a722 100644 --- a/asio/include/asio/detail/win_iocp_overlapped_ptr.hpp +++ b/asio/include/asio/detail/win_iocp_overlapped_ptr.hpp @@ -19,12 +19,12 @@ #if defined(ASIO_HAS_IOCP) -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/detail/handler_alloc_helpers.hpp" #include "asio/detail/memory.hpp" #include "asio/detail/noncopyable.hpp" #include "asio/detail/win_iocp_overlapped_op.hpp" -#include "asio/detail/win_iocp_io_service.hpp" +#include "asio/detail/win_iocp_io_context.hpp" #include "asio/detail/push_options.hpp" @@ -46,11 +46,11 @@ public: // Construct an win_iocp_overlapped_ptr to contain the specified handler. template explicit win_iocp_overlapped_ptr( - asio::io_service& io_service, ASIO_MOVE_ARG(Handler) handler) + asio::io_context& io_context, ASIO_MOVE_ARG(Handler) handler) : ptr_(0), iocp_service_(0) { - this->reset(io_service, ASIO_MOVE_CAST(Handler)(handler)); + this->reset(io_context, ASIO_MOVE_CAST(Handler)(handler)); } // Destructor automatically frees the OVERLAPPED object unless released. @@ -74,21 +74,21 @@ public: // Reset to contain the specified handler, freeing any current OVERLAPPED // object. template - void reset(asio::io_service& io_service, Handler handler) + void reset(asio::io_context& io_context, Handler handler) { typedef win_iocp_overlapped_op op; typename op::ptr p = { asio::detail::addressof(handler), op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(handler); - ASIO_HANDLER_CREATION((io_service, *p.p, - "io_service", &io_service.impl_, 0, "overlapped")); + ASIO_HANDLER_CREATION((io_context, *p.p, + "io_context", &io_context.impl_, 0, "overlapped")); - io_service.impl_.work_started(); + io_context.impl_.work_started(); reset(); ptr_ = p.p; p.v = p.p = 0; - iocp_service_ = &io_service.impl_; + iocp_service_ = &io_context.impl_; } // Get the contained OVERLAPPED object. @@ -130,7 +130,7 @@ public: private: win_iocp_operation* ptr_; - win_iocp_io_service* iocp_service_; + win_iocp_io_context* iocp_service_; }; } // namespace detail diff --git a/asio/include/asio/detail/win_iocp_serial_port_service.hpp b/asio/include/asio/detail/win_iocp_serial_port_service.hpp index 2bfdcc50..b3969adf 100644 --- a/asio/include/asio/detail/win_iocp_serial_port_service.hpp +++ b/asio/include/asio/detail/win_iocp_serial_port_service.hpp @@ -22,7 +22,7 @@ #include #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/detail/win_iocp_handle_service.hpp" #include "asio/detail/push_options.hpp" @@ -42,7 +42,7 @@ public: // Constructor. ASIO_DECL win_iocp_serial_port_service( - asio::io_service& io_service); + asio::io_context& io_context); // Destroy all user-defined handler objects owned by the service. ASIO_DECL void shutdown_service(); diff --git a/asio/include/asio/detail/win_iocp_socket_accept_op.hpp b/asio/include/asio/detail/win_iocp_socket_accept_op.hpp index 1820a0fd..d8e2929a 100644 --- a/asio/include/asio/detail/win_iocp_socket_accept_op.hpp +++ b/asio/include/asio/detail/win_iocp_socket_accept_op.hpp @@ -167,13 +167,13 @@ public: win_iocp_socket_move_accept_op( win_iocp_socket_service_base& socket_service, socket_type socket, - const Protocol& protocol, asio::io_service& peer_io_service, + const Protocol& protocol, asio::io_context& peer_io_context, typename Protocol::endpoint* peer_endpoint, bool enable_connection_aborted, Handler& handler) : operation(&win_iocp_socket_move_accept_op::do_complete), socket_service_(socket_service), socket_(socket), - peer_(peer_io_service), + peer_(peer_io_context), protocol_(protocol), peer_endpoint_(peer_endpoint), enable_connection_aborted_(enable_connection_aborted), diff --git a/asio/include/asio/detail/win_iocp_socket_service.hpp b/asio/include/asio/detail/win_iocp_socket_service.hpp index bd485b38..1fdd98c7 100644 --- a/asio/include/asio/detail/win_iocp_socket_service.hpp +++ b/asio/include/asio/detail/win_iocp_socket_service.hpp @@ -21,7 +21,7 @@ #include #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/socket_base.hpp" #include "asio/detail/bind_handler.hpp" #include "asio/detail/buffer_sequence_adapter.hpp" @@ -36,7 +36,7 @@ #include "asio/detail/socket_holder.hpp" #include "asio/detail/socket_ops.hpp" #include "asio/detail/socket_types.hpp" -#include "asio/detail/win_iocp_io_service.hpp" +#include "asio/detail/win_iocp_io_context.hpp" #include "asio/detail/win_iocp_null_buffers_op.hpp" #include "asio/detail/win_iocp_socket_accept_op.hpp" #include "asio/detail/win_iocp_socket_connect_op.hpp" @@ -127,8 +127,8 @@ public: }; // Constructor. - win_iocp_socket_service(asio::io_service& io_service) - : win_iocp_socket_service_base(io_service) + win_iocp_socket_service(asio::io_context& io_context) + : win_iocp_socket_service_base(io_context) { } @@ -316,7 +316,7 @@ public: op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(impl.cancel_token_, buffers, handler); - ASIO_HANDLER_CREATION((io_service_, *p.p, "socket", + ASIO_HANDLER_CREATION((io_context_, *p.p, "socket", &impl, impl.socket_, "async_send_to")); buffer_sequence_adaptercapacity() : 0; socket_holder new_socket(socket_ops::sync_accept(impl.socket_, @@ -501,7 +501,7 @@ public: p.p = new (p.v) op(*this, impl.socket_, peer, impl.protocol_, peer_endpoint, enable_connection_aborted, handler); - ASIO_HANDLER_CREATION((io_service_, *p.p, "socket", + ASIO_HANDLER_CREATION((io_context_, *p.p, "socket", &impl, impl.socket_, "async_accept")); start_accept_op(impl, peer.is_open(), p.p->new_socket(), @@ -516,7 +516,7 @@ public: // must be valid until the accept's handler is invoked. template void async_accept(implementation_type& impl, - asio::io_service* peer_io_service, + asio::io_context* peer_io_context, endpoint_type* peer_endpoint, Handler& handler) { // Allocate and construct an operation to wrap the handler. @@ -526,10 +526,10 @@ public: bool enable_connection_aborted = (impl.state_ & socket_ops::enable_connection_aborted) != 0; p.p = new (p.v) op(*this, impl.socket_, impl.protocol_, - peer_io_service ? *peer_io_service : io_service_, + peer_io_context ? *peer_io_context : io_context_, peer_endpoint, enable_connection_aborted, handler); - ASIO_HANDLER_CREATION((io_service_, *p.p, "socket", + ASIO_HANDLER_CREATION((io_context_, *p.p, "socket", &impl, impl.socket_, "async_accept")); start_accept_op(impl, false, p.p->new_socket(), @@ -560,7 +560,7 @@ public: op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(impl.socket_, handler); - ASIO_HANDLER_CREATION((io_service_, *p.p, "socket", + ASIO_HANDLER_CREATION((io_context_, *p.p, "socket", &impl, impl.socket_, "async_connect")); start_connect_op(impl, impl.protocol_.family(), impl.protocol_.type(), diff --git a/asio/include/asio/detail/win_iocp_socket_service_base.hpp b/asio/include/asio/detail/win_iocp_socket_service_base.hpp index 8e12a476..471f097a 100644 --- a/asio/include/asio/detail/win_iocp_socket_service_base.hpp +++ b/asio/include/asio/detail/win_iocp_socket_service_base.hpp @@ -20,7 +20,7 @@ #if defined(ASIO_HAS_IOCP) #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/socket_base.hpp" #include "asio/detail/bind_handler.hpp" #include "asio/detail/buffer_sequence_adapter.hpp" @@ -35,7 +35,7 @@ #include "asio/detail/socket_holder.hpp" #include "asio/detail/socket_ops.hpp" #include "asio/detail/socket_types.hpp" -#include "asio/detail/win_iocp_io_service.hpp" +#include "asio/detail/win_iocp_io_context.hpp" #include "asio/detail/win_iocp_null_buffers_op.hpp" #include "asio/detail/win_iocp_socket_connect_op.hpp" #include "asio/detail/win_iocp_socket_send_op.hpp" @@ -86,7 +86,7 @@ public: // Constructor. ASIO_DECL win_iocp_socket_service_base( - asio::io_service& io_service); + asio::io_context& io_context); // Destroy all user-defined handler objects owned by the service. ASIO_DECL void shutdown_service(); @@ -227,7 +227,7 @@ public: op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(impl.cancel_token_, handler); - ASIO_HANDLER_CREATION((io_service_, *p.p, "socket", + ASIO_HANDLER_CREATION((io_context_, *p.p, "socket", &impl, impl.socket_, "async_wait")); switch (w) @@ -286,7 +286,7 @@ public: op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(impl.cancel_token_, buffers, handler); - ASIO_HANDLER_CREATION((io_service_, *p.p, "socket", + ASIO_HANDLER_CREATION((io_context_, *p.p, "socket", &impl, impl.socket_, "async_send")); buffer_sequence_adapter(impl.wait_handle_), "async_wait")); start_wait_op(impl, p.p); @@ -156,8 +156,8 @@ private: static ASIO_DECL VOID CALLBACK wait_callback( PVOID param, BOOLEAN timeout); - // The io_service implementation used to post completions. - io_service_impl& io_service_; + // The io_context implementation used to post completions. + io_context_impl& io_context_; // Mutex to protect access to internal state. mutex mutex_; diff --git a/asio/include/asio/detail/winrt_async_manager.hpp b/asio/include/asio/detail/winrt_async_manager.hpp index 9799669e..89bd27b4 100644 --- a/asio/include/asio/detail/winrt_async_manager.hpp +++ b/asio/include/asio/detail/winrt_async_manager.hpp @@ -23,7 +23,7 @@ #include "asio/detail/atomic_count.hpp" #include "asio/detail/winrt_async_op.hpp" #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/detail/push_options.hpp" @@ -35,9 +35,9 @@ class winrt_async_manager { public: // Constructor. - winrt_async_manager(asio::io_service& io_service) - : asio::detail::service_base(io_service), - io_service_(use_service(io_service)), + winrt_async_manager(asio::io_context& io_context) + : asio::detail::service_base(io_context), + io_context_(use_service(io_context)), outstanding_ops_(1) { } @@ -185,12 +185,12 @@ public: asio::system_category()); break; } - io_service_.post_deferred_completion(handler); + io_context_.post_deferred_completion(handler); if (--outstanding_ops_ == 0) promise_.set_value(); }); - io_service_.work_started(); + io_context_.work_started(); ++outstanding_ops_; action->Completed = on_completed; } @@ -222,12 +222,12 @@ public: asio::system_category()); break; } - io_service_.post_deferred_completion(handler); + io_context_.post_deferred_completion(handler); if (--outstanding_ops_ == 0) promise_.set_value(); }); - io_service_.work_started(); + io_context_.work_started(); ++outstanding_ops_; operation->Completed = on_completed; } @@ -263,19 +263,19 @@ public: asio::system_category()); break; } - io_service_.post_deferred_completion(handler); + io_context_.post_deferred_completion(handler); if (--outstanding_ops_ == 0) promise_.set_value(); }); - io_service_.work_started(); + io_context_.work_started(); ++outstanding_ops_; operation->Completed = on_completed; } private: - // The io_service implementation used to post completed handlers. - io_service_impl& io_service_; + // The io_context implementation used to post completed handlers. + io_context_impl& io_context_; // Count of outstanding operations. atomic_count outstanding_ops_; diff --git a/asio/include/asio/detail/winrt_resolver_service.hpp b/asio/include/asio/detail/winrt_resolver_service.hpp index b8a2308b..9649e579 100644 --- a/asio/include/asio/detail/winrt_resolver_service.hpp +++ b/asio/include/asio/detail/winrt_resolver_service.hpp @@ -52,9 +52,9 @@ public: typedef asio::ip::basic_resolver_results results_type; // Constructor. - winrt_resolver_service(asio::io_service& io_service) - : io_service_(use_service(io_service)), - async_manager_(use_service(io_service)) + winrt_resolver_service(asio::io_context& io_context) + : io_context_(use_service(io_context)), + async_manager_(use_service(io_context)) { } @@ -69,7 +69,7 @@ public: } // Perform any fork-related housekeeping. - void fork_service(asio::io_service::fork_event) + void fork_service(asio::io_context::fork_event) { } @@ -129,7 +129,7 @@ public: op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(query, handler); - ASIO_HANDLER_CREATION((io_service_.context(), + ASIO_HANDLER_CREATION((io_context_.context(), *p.p, "resolver", &impl, 0, "async_resolve")); (void)impl; @@ -145,7 +145,7 @@ public: { p.p->ec_ = asio::error_code( e->HResult, asio::system_category()); - io_service_.post_immediate_completion(p.p, is_continuation); + io_context_.post_immediate_completion(p.p, is_continuation); p.v = p.p = 0; } } @@ -165,12 +165,12 @@ public: { asio::error_code ec = asio::error::operation_not_supported; const results_type results; - io_service_.get_io_service().post( + io_context_.get_io_context().post( detail::bind_handler(handler, ec, results)); } private: - io_service_impl& io_service_; + io_context_impl& io_context_; winrt_async_manager& async_manager_; }; diff --git a/asio/include/asio/detail/winrt_ssocket_service.hpp b/asio/include/asio/detail/winrt_ssocket_service.hpp index f539ac7b..fb97ea2b 100644 --- a/asio/include/asio/detail/winrt_ssocket_service.hpp +++ b/asio/include/asio/detail/winrt_ssocket_service.hpp @@ -20,7 +20,7 @@ #if defined(ASIO_WINDOWS_RUNTIME) #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/detail/memory.hpp" #include "asio/detail/winrt_socket_connect_op.hpp" #include "asio/detail/winrt_ssocket_service_base.hpp" @@ -60,8 +60,8 @@ public: }; // Constructor. - winrt_ssocket_service(asio::io_service& io_service) - : winrt_ssocket_service_base(io_service) + winrt_ssocket_service(asio::io_context& io_context) + : winrt_ssocket_service_base(io_context) { } @@ -214,7 +214,7 @@ public: op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(handler); - ASIO_HANDLER_CREATION((io_service_.context(), + ASIO_HANDLER_CREATION((io_context_.context(), *p.p, "socket", &impl, 0, "async_connect")); start_connect_op(impl, peer_endpoint.data(), p.p, is_continuation); diff --git a/asio/include/asio/detail/winrt_ssocket_service_base.hpp b/asio/include/asio/detail/winrt_ssocket_service_base.hpp index 78017c30..bb901dfc 100644 --- a/asio/include/asio/detail/winrt_ssocket_service_base.hpp +++ b/asio/include/asio/detail/winrt_ssocket_service_base.hpp @@ -21,7 +21,7 @@ #include "asio/buffer.hpp" #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/socket_base.hpp" #include "asio/detail/buffer_sequence_adapter.hpp" #include "asio/detail/memory.hpp" @@ -62,7 +62,7 @@ public: // Constructor. ASIO_DECL winrt_ssocket_service_base( - asio::io_service& io_service); + asio::io_context& io_context); // Destroy all user-defined handler objects owned by the service. ASIO_DECL void shutdown_service(); @@ -202,7 +202,7 @@ public: op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(buffers, handler); - ASIO_HANDLER_CREATION((io_service_.context(), + ASIO_HANDLER_CREATION((io_context_.context(), *p.p, "socket", &impl, 0, "async_send")); start_send_op(impl, @@ -219,7 +219,7 @@ public: { asio::error_code ec = asio::error::operation_not_supported; const std::size_t bytes_transferred = 0; - io_service_.get_io_service().post( + io_context_.get_io_context().post( detail::bind_handler(handler, ec, bytes_transferred)); } @@ -258,7 +258,7 @@ public: op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(buffers, handler); - ASIO_HANDLER_CREATION((io_service_.context(), + ASIO_HANDLER_CREATION((io_context_.context(), *p.p, "socket", &impl, 0, "async_receive")); start_receive_op(impl, @@ -275,7 +275,7 @@ public: { asio::error_code ec = asio::error::operation_not_supported; const std::size_t bytes_transferred = 0; - io_service_.get_io_service().post( + io_context_.get_io_context().post( detail::bind_handler(handler, ec, bytes_transferred)); } @@ -328,8 +328,8 @@ protected: winrt_async_op* op, bool is_continuation); - // The io_service implementation used for delivering completions. - io_service_impl& io_service_; + // The io_context implementation used for delivering completions. + io_context_impl& io_context_; // The manager that keeps track of outstanding operations. winrt_async_manager& async_manager_; diff --git a/asio/include/asio/detail/winrt_timer_scheduler.hpp b/asio/include/asio/detail/winrt_timer_scheduler.hpp index 4c2d5b9e..f439e1a2 100644 --- a/asio/include/asio/detail/winrt_timer_scheduler.hpp +++ b/asio/include/asio/detail/winrt_timer_scheduler.hpp @@ -28,7 +28,7 @@ #include "asio/detail/timer_queue_base.hpp" #include "asio/detail/timer_queue_set.hpp" #include "asio/detail/wait_op.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #if defined(ASIO_HAS_IOCP) # include "asio/detail/thread.hpp" @@ -44,7 +44,7 @@ class winrt_timer_scheduler { public: // Constructor. - ASIO_DECL winrt_timer_scheduler(asio::io_service& io_service); + ASIO_DECL winrt_timer_scheduler(asio::io_context& io_context); // Destructor. ASIO_DECL ~winrt_timer_scheduler(); @@ -54,7 +54,7 @@ public: // Recreate internal descriptors following a fork. ASIO_DECL void fork_service( - asio::io_service::fork_event fork_ev); + asio::io_context::fork_event fork_ev); // Initialise the task. No effect as this class uses its own thread. ASIO_DECL void init_task(); @@ -100,8 +100,8 @@ private: // Helper function to remove a timer queue. ASIO_DECL void do_remove_timer_queue(timer_queue_base& queue); - // The io_service implementation used to post completions. - io_service_impl& io_service_; + // The io_context implementation used to post completions. + io_context_impl& io_context_; // Mutex used to protect internal variables. asio::detail::mutex mutex_; diff --git a/asio/include/asio/execution_context.hpp b/asio/include/asio/execution_context.hpp index 4d7d98e5..5d428392 100644 --- a/asio/include/asio/execution_context.hpp +++ b/asio/include/asio/execution_context.hpp @@ -27,11 +27,11 @@ namespace asio { class execution_context; -class io_service; +class io_context; #if !defined(GENERATING_DOCUMENTATION) template Service& use_service(execution_context&); -template Service& use_service(io_service&); +template Service& use_service(io_context&); template void add_service(execution_context&, Service*); template bool has_service(execution_context&); #endif // !defined(ASIO_NO_DEPRECATED) @@ -41,7 +41,7 @@ namespace detail { class service_registry; } /// A context for function object execution. /** * An execution context represents a place where function objects will be - * executed. An @c io_service is an example of an execution context. + * executed. An @c io_context is an example of an execution context. * * @par The execution_context class and services * @@ -79,7 +79,7 @@ namespace detail { class service_registry; } * @par The execution_context as a base class * * Class execution_context may be used only as a base class for concrete - * execution context types. The @c io_service is an example of such a derived + * execution context types. The @c io_context is an example of such a derived * type. * * On destruction, a class that is derived from execution_context must perform @@ -96,8 +96,8 @@ namespace detail { class service_registry; } * complete. The corresponding handler objects are destroyed, and all @c * shared_ptr references to the objects are destroyed. * - * @li To shut down the whole program, the io_service function stop() is called - * to terminate any run() calls as soon as possible. The io_service destructor + * @li To shut down the whole program, the io_context function stop() is called + * to terminate any run() calls as soon as possible. The io_context destructor * calls @c shutdown_context() and @c destroy_context() to destroy all pending * handlers, causing all @c shared_ptr references to all connection objects to * be destroyed. @@ -210,18 +210,18 @@ public: /** * This function is used to locate a service object that corresponds to the * given service type. If there is no existing implementation of the service, - * then the io_service will create a new instance of the service. + * then the io_context will create a new instance of the service. * - * @param ios The io_service object that owns the service. + * @param ioc The io_context object that owns the service. * * @return The service interface implementing the specified service type. * Ownership of the service interface is not transferred to the caller. * * @note This overload is preserved for backwards compatibility with services - * that inherit from io_service::service. + * that inherit from io_context::service. */ template - friend Service& use_service(io_service& ios); + friend Service& use_service(io_context& ioc); #if defined(GENERATING_DOCUMENTATION) @@ -310,7 +310,7 @@ public: id() {} }; -/// Base class for all io_service services. +/// Base class for all io_context services. class execution_context::service : private noncopyable { diff --git a/asio/include/asio/handler_invoke_hook.hpp b/asio/include/asio/handler_invoke_hook.hpp index 8a2ed43a..209c01b1 100644 --- a/asio/include/asio/handler_invoke_hook.hpp +++ b/asio/include/asio/handler_invoke_hook.hpp @@ -26,12 +26,12 @@ namespace asio { * @brief Default invoke function for handlers. * * Completion handlers for asynchronous operations are invoked by the - * io_service associated with the corresponding object (e.g. a socket or + * io_context associated with the corresponding object (e.g. a socket or * deadline_timer). Certain guarantees are made on when the handler may be * invoked, in particular that a handler can only be invoked from a thread that - * is currently calling @c run() on the corresponding io_service object. + * is currently calling @c run() on the corresponding io_context object. * Handlers may subsequently be invoked through other objects (such as - * io_service::strand objects) that provide additional guarantees. + * io_context::strand objects) that provide additional guarantees. * * When asynchronous operations are composed from other asynchronous * operations, all intermediate handlers should be invoked using the same diff --git a/asio/include/asio/impl/io_service.hpp b/asio/include/asio/impl/io_context.hpp similarity index 69% rename from asio/include/asio/impl/io_service.hpp rename to asio/include/asio/impl/io_context.hpp index b6d1a698..90454401 100644 --- a/asio/include/asio/impl/io_service.hpp +++ b/asio/include/asio/impl/io_context.hpp @@ -1,5 +1,5 @@ // -// impl/io_service.hpp +// impl/io_context.hpp // ~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) @@ -8,8 +8,8 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef ASIO_IMPL_IO_SERVICE_HPP -#define ASIO_IMPL_IO_SERVICE_HPP +#ifndef ASIO_IMPL_IO_CONTEXT_HPP +#define ASIO_IMPL_IO_CONTEXT_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once @@ -28,20 +28,20 @@ namespace asio { template -inline Service& use_service(io_service& ios) +inline Service& use_service(io_context& ioc) { // Check that Service meets the necessary type requirements. (void)static_cast(static_cast(0)); (void)static_cast(&Service::id); - return ios.service_registry_->template use_service(ios); + return ioc.service_registry_->template use_service(ioc); } template <> -inline detail::io_service_impl& use_service( - io_service& ios) +inline detail::io_context_impl& use_service( + io_context& ioc) { - return ios.impl_; + return ioc.impl_; } } // namespace asio @@ -49,7 +49,7 @@ inline detail::io_service_impl& use_service( #include "asio/detail/pop_options.hpp" #if defined(ASIO_HAS_IOCP) -# include "asio/detail/win_iocp_io_service.hpp" +# include "asio/detail/win_iocp_io_context.hpp" #else # include "asio/detail/scheduler.hpp" #endif @@ -58,22 +58,22 @@ inline detail::io_service_impl& use_service( namespace asio { -inline io_service::executor_type -io_service::get_executor() ASIO_NOEXCEPT +inline io_context::executor_type +io_context::get_executor() ASIO_NOEXCEPT { return executor_type(*this); } #if !defined(ASIO_NO_DEPRECATED) -inline void io_service::reset() +inline void io_context::reset() { restart(); } template ASIO_INITFN_RESULT_TYPE(CompletionHandler, void ()) -io_service::dispatch(ASIO_MOVE_ARG(CompletionHandler) handler) +io_context::dispatch(ASIO_MOVE_ARG(CompletionHandler) handler) { // If you get an error on the following line it means that your handler does // not meet the documented type requirements for a CompletionHandler. @@ -96,7 +96,7 @@ io_service::dispatch(ASIO_MOVE_ARG(CompletionHandler) handler) p.p = new (p.v) op(init.handler); ASIO_HANDLER_CREATION((*this, *p.p, - "io_service", this, 0, "dispatch")); + "io_context", this, 0, "dispatch")); impl_.do_dispatch(p.p); p.v = p.p = 0; @@ -107,7 +107,7 @@ io_service::dispatch(ASIO_MOVE_ARG(CompletionHandler) handler) template ASIO_INITFN_RESULT_TYPE(CompletionHandler, void ()) -io_service::post(ASIO_MOVE_ARG(CompletionHandler) handler) +io_context::post(ASIO_MOVE_ARG(CompletionHandler) handler) { // If you get an error on the following line it means that your handler does // not meet the documented type requirements for a CompletionHandler. @@ -126,7 +126,7 @@ io_service::post(ASIO_MOVE_ARG(CompletionHandler) handler) p.p = new (p.v) op(init.handler); ASIO_HANDLER_CREATION((*this, *p.p, - "io_service", this, 0, "post")); + "io_context", this, 0, "post")); impl_.post_immediate_completion(p.p, is_continuation); p.v = p.p = 0; @@ -138,33 +138,33 @@ template #if defined(GENERATING_DOCUMENTATION) unspecified #else -inline detail::wrapped_handler +inline detail::wrapped_handler #endif -io_service::wrap(Handler handler) +io_context::wrap(Handler handler) { - return detail::wrapped_handler(*this, handler); + return detail::wrapped_handler(*this, handler); } #endif // !defined(ASIO_NO_DEPRECATED) -inline io_service& -io_service::executor_type::context() ASIO_NOEXCEPT +inline io_context& +io_context::executor_type::context() ASIO_NOEXCEPT { - return io_service_; + return io_context_; } -inline void io_service::executor_type::on_work_started() ASIO_NOEXCEPT +inline void io_context::executor_type::on_work_started() ASIO_NOEXCEPT { - io_service_.impl_.work_started(); + io_context_.impl_.work_started(); } -inline void io_service::executor_type::on_work_finished() ASIO_NOEXCEPT +inline void io_context::executor_type::on_work_finished() ASIO_NOEXCEPT { - io_service_.impl_.work_finished(); + io_context_.impl_.work_finished(); } template -void io_service::executor_type::dispatch( +void io_context::executor_type::dispatch( ASIO_MOVE_ARG(Function) f, const Allocator& a) { // Make a local, non-const copy of the function. @@ -172,7 +172,7 @@ void io_service::executor_type::dispatch( function_type tmp(ASIO_MOVE_CAST(Function)(f)); // Invoke immediately if we are already inside the thread pool. - if (io_service_.impl_.can_dispatch()) + if (io_context_.impl_.can_dispatch()) { detail::fenced_block b(detail::fenced_block::full); asio_handler_invoke_helpers::invoke(tmp, tmp); @@ -190,14 +190,14 @@ void io_service::executor_type::dispatch( p.p = new (p.v) op(tmp, allocator); ASIO_HANDLER_CREATION((this->context(), - *p.p, "io_service", this, 0, "post")); + *p.p, "io_context", this, 0, "post")); - io_service_.impl_.post_immediate_completion(p.p, false); + io_context_.impl_.post_immediate_completion(p.p, false); p.v = p.p = 0; } template -void io_service::executor_type::post( +void io_context::executor_type::post( ASIO_MOVE_ARG(Function) f, const Allocator& a) { // Make a local, non-const copy of the function. @@ -215,14 +215,14 @@ void io_service::executor_type::post( p.p = new (p.v) op(tmp, allocator); ASIO_HANDLER_CREATION((this->context(), - *p.p, "io_service", this, 0, "post")); + *p.p, "io_context", this, 0, "post")); - io_service_.impl_.post_immediate_completion(p.p, false); + io_context_.impl_.post_immediate_completion(p.p, false); p.v = p.p = 0; } template -void io_service::executor_type::defer( +void io_context::executor_type::defer( ASIO_MOVE_ARG(Function) f, const Allocator& a) { // Make a local, non-const copy of the function. @@ -240,47 +240,61 @@ void io_service::executor_type::defer( p.p = new (p.v) op(tmp, allocator); ASIO_HANDLER_CREATION((this->context(), - *p.p, "io_service", this, 0, "defer")); + *p.p, "io_context", this, 0, "defer")); - io_service_.impl_.post_immediate_completion(p.p, true); + io_context_.impl_.post_immediate_completion(p.p, true); p.v = p.p = 0; } inline bool -io_service::executor_type::running_in_this_thread() const ASIO_NOEXCEPT +io_context::executor_type::running_in_this_thread() const ASIO_NOEXCEPT { - return io_service_.impl_.can_dispatch(); + return io_context_.impl_.can_dispatch(); } -inline io_service::work::work(asio::io_service& io_service) - : io_service_impl_(io_service.impl_) +inline io_context::work::work(asio::io_context& io_context) + : io_context_impl_(io_context.impl_) { - io_service_impl_.work_started(); + io_context_impl_.work_started(); } -inline io_service::work::work(const work& other) - : io_service_impl_(other.io_service_impl_) +inline io_context::work::work(const work& other) + : io_context_impl_(other.io_context_impl_) { - io_service_impl_.work_started(); + io_context_impl_.work_started(); } -inline io_service::work::~work() +inline io_context::work::~work() { - io_service_impl_.work_finished(); + io_context_impl_.work_finished(); } -inline asio::io_service& io_service::work::get_io_service() +inline asio::io_context& io_context::work::get_io_context() { - return static_cast(io_service_impl_.context()); + return static_cast(io_context_impl_.context()); } -inline asio::io_service& io_service::service::get_io_service() +#if !defined(ASIO_NO_DEPRECATED) +inline asio::io_context& io_context::work::get_io_service() { - return static_cast(context()); + return static_cast(io_context_impl_.context()); } +#endif // !defined(ASIO_NO_DEPRECATED) + +inline asio::io_context& io_context::service::get_io_context() +{ + return static_cast(context()); +} + +#if !defined(ASIO_NO_DEPRECATED) +inline asio::io_context& io_context::service::get_io_service() +{ + return static_cast(context()); +} +#endif // !defined(ASIO_NO_DEPRECATED) } // namespace asio #include "asio/detail/pop_options.hpp" -#endif // ASIO_IMPL_IO_SERVICE_HPP +#endif // ASIO_IMPL_IO_CONTEXT_HPP diff --git a/asio/include/asio/impl/io_service.ipp b/asio/include/asio/impl/io_context.ipp similarity index 66% rename from asio/include/asio/impl/io_service.ipp rename to asio/include/asio/impl/io_context.ipp index 7088b81a..b35a8481 100644 --- a/asio/include/asio/impl/io_service.ipp +++ b/asio/include/asio/impl/io_context.ipp @@ -1,5 +1,5 @@ // -// impl/io_service.ipp +// impl/io_context.ipp // ~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) @@ -8,22 +8,22 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef ASIO_IMPL_IO_SERVICE_IPP -#define ASIO_IMPL_IO_SERVICE_IPP +#ifndef ASIO_IMPL_IO_CONTEXT_IPP +#define ASIO_IMPL_IO_CONTEXT_IPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/detail/limits.hpp" #include "asio/detail/scoped_ptr.hpp" #include "asio/detail/service_registry.hpp" #include "asio/detail/throw_error.hpp" #if defined(ASIO_HAS_IOCP) -# include "asio/detail/win_iocp_io_service.hpp" +# include "asio/detail/win_iocp_io_context.hpp" #else # include "asio/detail/scheduler.hpp" #endif @@ -32,17 +32,17 @@ namespace asio { -io_service::io_service() +io_context::io_context() : impl_(create_impl()) { } -io_service::io_service(std::size_t concurrency_hint) +io_context::io_context(std::size_t concurrency_hint) : impl_(create_impl(concurrency_hint)) { } -io_service::impl_type& io_service::create_impl(std::size_t concurrency_hint) +io_context::impl_type& io_context::create_impl(std::size_t concurrency_hint) { asio::detail::scoped_ptr impl( new impl_type(*this, concurrency_hint)); @@ -50,11 +50,11 @@ io_service::impl_type& io_service::create_impl(std::size_t concurrency_hint) return *impl.release(); } -io_service::~io_service() +io_context::~io_context() { } -std::size_t io_service::run() +std::size_t io_context::run() { asio::error_code ec; std::size_t s = impl_.run(ec); @@ -62,12 +62,12 @@ std::size_t io_service::run() return s; } -std::size_t io_service::run(asio::error_code& ec) +std::size_t io_context::run(asio::error_code& ec) { return impl_.run(ec); } -std::size_t io_service::run_one() +std::size_t io_context::run_one() { asio::error_code ec; std::size_t s = impl_.run_one(ec); @@ -75,12 +75,12 @@ std::size_t io_service::run_one() return s; } -std::size_t io_service::run_one(asio::error_code& ec) +std::size_t io_context::run_one(asio::error_code& ec) { return impl_.run_one(ec); } -std::size_t io_service::poll() +std::size_t io_context::poll() { asio::error_code ec; std::size_t s = impl_.poll(ec); @@ -88,12 +88,12 @@ std::size_t io_service::poll() return s; } -std::size_t io_service::poll(asio::error_code& ec) +std::size_t io_context::poll(asio::error_code& ec) { return impl_.poll(ec); } -std::size_t io_service::poll_one() +std::size_t io_context::poll_one() { asio::error_code ec; std::size_t s = impl_.poll_one(ec); @@ -101,32 +101,32 @@ std::size_t io_service::poll_one() return s; } -std::size_t io_service::poll_one(asio::error_code& ec) +std::size_t io_context::poll_one(asio::error_code& ec) { return impl_.poll_one(ec); } -void io_service::stop() +void io_context::stop() { impl_.stop(); } -bool io_service::stopped() const +bool io_context::stopped() const { return impl_.stopped(); } -void io_service::restart() +void io_context::restart() { impl_.restart(); } -io_service::service::service(asio::io_service& owner) +io_context::service::service(asio::io_context& owner) : execution_context::service(owner) { } -io_service::service::~service() +io_context::service::~service() { } @@ -134,4 +134,4 @@ io_service::service::~service() #include "asio/detail/pop_options.hpp" -#endif // ASIO_IMPL_IO_SERVICE_IPP +#endif // ASIO_IMPL_IO_CONTEXT_IPP diff --git a/asio/include/asio/impl/spawn.hpp b/asio/include/asio/impl/spawn.hpp index 32561d13..a69df96a 100644 --- a/asio/include/asio/impl/spawn.hpp +++ b/asio/include/asio/impl/spawn.hpp @@ -423,7 +423,7 @@ inline void spawn(const strand& ex, } template -inline void spawn(const asio::io_service::strand& s, +inline void spawn(const asio::io_context::strand& s, ASIO_MOVE_ARG(Function) function, const boost::coroutines::attributes& attributes) { diff --git a/asio/include/asio/impl/src.hpp b/asio/include/asio/impl/src.hpp index 5a619f8d..06a25517 100644 --- a/asio/include/asio/impl/src.hpp +++ b/asio/include/asio/impl/src.hpp @@ -24,7 +24,7 @@ #include "asio/impl/execution_context.ipp" #include "asio/impl/executor.ipp" #include "asio/impl/handler_alloc_hook.ipp" -#include "asio/impl/io_service.ipp" +#include "asio/impl/io_context.ipp" #include "asio/impl/serial_port_base.ipp" #include "asio/impl/system_executor.ipp" #include "asio/impl/thread_pool.ipp" @@ -56,7 +56,7 @@ #include "asio/detail/impl/timer_queue_ptime.ipp" #include "asio/detail/impl/timer_queue_set.ipp" #include "asio/detail/impl/win_iocp_handle_service.ipp" -#include "asio/detail/impl/win_iocp_io_service.ipp" +#include "asio/detail/impl/win_iocp_io_context.ipp" #include "asio/detail/impl/win_iocp_serial_port_service.ipp" #include "asio/detail/impl/win_iocp_socket_service_base.ipp" #include "asio/detail/impl/win_event.ipp" diff --git a/asio/include/asio/io_context.hpp b/asio/include/asio/io_context.hpp new file mode 100644 index 00000000..8e672c76 --- /dev/null +++ b/asio/include/asio/io_context.hpp @@ -0,0 +1,734 @@ +// +// io_context.hpp +// ~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef ASIO_IO_CONTEXT_HPP +#define ASIO_IO_CONTEXT_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include "asio/detail/config.hpp" +#include +#include +#include +#include "asio/async_result.hpp" +#include "asio/detail/noncopyable.hpp" +#include "asio/detail/wrapped_handler.hpp" +#include "asio/error_code.hpp" +#include "asio/execution_context.hpp" +#include "asio/is_executor.hpp" + +#if defined(ASIO_WINDOWS) || defined(__CYGWIN__) +# include "asio/detail/winsock_init.hpp" +#elif defined(__sun) || defined(__QNX__) || defined(__hpux) || defined(_AIX) \ + || defined(__osf__) +# include "asio/detail/signal_init.hpp" +#endif + +#include "asio/detail/push_options.hpp" + +namespace asio { + +namespace detail { +#if defined(ASIO_HAS_IOCP) + typedef class win_iocp_io_context io_context_impl; + class win_iocp_overlapped_ptr; +#else + typedef class scheduler io_context_impl; +#endif +} // namespace detail + +/// Provides core I/O functionality. +/** + * The io_context class provides the core I/O functionality for users of the + * asynchronous I/O objects, including: + * + * @li asio::ip::tcp::socket + * @li asio::ip::tcp::acceptor + * @li asio::ip::udp::socket + * @li asio::deadline_timer. + * + * The io_context class also includes facilities intended for developers of + * custom asynchronous services. + * + * @par Thread Safety + * @e Distinct @e objects: Safe.@n + * @e Shared @e objects: Safe, with the specific exceptions of the restart() and + * notify_fork() functions. Calling restart() while there are unfinished run(), + * run_one(), poll() or poll_one() calls results in undefined behaviour. The + * notify_fork() function should not be called while any io_context function, + * or any function on an I/O object that is associated with the io_context, is + * being called in another thread. + * + * @par Concepts: + * Dispatcher. + * + * @par Synchronous and asynchronous operations + * + * Synchronous operations on I/O objects implicitly run the io_context object + * for an individual operation. The io_context functions run(), run_one(), + * poll() or poll_one() must be called for the io_context to perform + * asynchronous operations on behalf of a C++ program. Notification that an + * asynchronous operation has completed is delivered by invocation of the + * associated handler. Handlers are invoked only by a thread that is currently + * calling any overload of run(), run_one(), poll() or poll_one() for the + * io_context. + * + * @par Effect of exceptions thrown from handlers + * + * If an exception is thrown from a handler, the exception is allowed to + * propagate through the throwing thread's invocation of run(), run_one(), + * poll() or poll_one(). No other threads that are calling any of these + * functions are affected. It is then the responsibility of the application to + * catch the exception. + * + * After the exception has been caught, the run(), run_one(), poll() or + * poll_one() call may be restarted @em without the need for an intervening + * call to restart(). This allows the thread to rejoin the io_context object's + * thread pool without impacting any other threads in the pool. + * + * For example: + * + * @code + * asio::io_context io_context; + * ... + * for (;;) + * { + * try + * { + * io_context.run(); + * break; // run() exited normally + * } + * catch (my_exception& e) + * { + * // Deal with exception as appropriate. + * } + * } + * @endcode + * + * @par Stopping the io_context from running out of work + * + * Some applications may need to prevent an io_context object's run() call from + * returning when there is no more work to do. For example, the io_context may + * be being run in a background thread that is launched prior to the + * application's asynchronous operations. The run() call may be kept running by + * creating an object of type asio::io_context::work: + * + * @code asio::io_context io_context; + * asio::io_context::work work(io_context); + * ... @endcode + * + * To effect a shutdown, the application will then need to call the io_context + * object's stop() member function. This will cause the io_context run() call + * to return as soon as possible, abandoning unfinished operations and without + * permitting ready handlers to be dispatched. + * + * Alternatively, if the application requires that all operations and handlers + * be allowed to finish normally, the work object may be explicitly destroyed. + * + * @code asio::io_context io_context; + * auto_ptr work( + * new asio::io_context::work(io_context)); + * ... + * work.reset(); // Allow run() to exit. @endcode + */ +class io_context + : public execution_context +{ +private: + typedef detail::io_context_impl impl_type; +#if defined(ASIO_HAS_IOCP) + friend class detail::win_iocp_overlapped_ptr; +#endif + +public: + class executor_type; + friend class executor_type; + + class work; + friend class work; + + class service; + + class strand; + + /// Constructor. + ASIO_DECL io_context(); + + /// Constructor. + /** + * Construct with a hint about the required level of concurrency. + * + * @param concurrency_hint A suggestion to the implementation on how many + * threads it should allow to run simultaneously. + */ + ASIO_DECL explicit io_context(std::size_t concurrency_hint); + + /// Destructor. + /** + * On destruction, the io_context performs the following sequence of + * operations: + * + * @li For each service object @c svc in the io_context set, in reverse order + * of the beginning of service object lifetime, performs + * @c svc->shutdown_service(). + * + * @li Uninvoked handler objects that were scheduled for deferred invocation + * on the io_context, or any associated strand, are destroyed. + * + * @li For each service object @c svc in the io_context set, in reverse order + * of the beginning of service object lifetime, performs + * delete static_cast(svc). + * + * @note The destruction sequence described above permits programs to + * simplify their resource management by using @c shared_ptr<>. Where an + * object's lifetime is tied to the lifetime of a connection (or some other + * sequence of asynchronous operations), a @c shared_ptr to the object would + * be bound into the handlers for all asynchronous operations associated with + * it. This works as follows: + * + * @li When a single connection ends, all associated asynchronous operations + * complete. The corresponding handler objects are destroyed, and all + * @c shared_ptr references to the objects are destroyed. + * + * @li To shut down the whole program, the io_context function stop() is + * called to terminate any run() calls as soon as possible. The io_context + * destructor defined above destroys all handlers, causing all @c shared_ptr + * references to all connection objects to be destroyed. + */ + ASIO_DECL ~io_context(); + + /// Obtains the executor associated with the io_context. + executor_type get_executor() ASIO_NOEXCEPT; + + /// Run the io_context object's event processing loop. + /** + * The run() function blocks until all work has finished and there are no + * more handlers to be dispatched, or until the io_context has been stopped. + * + * Multiple threads may call the run() function to set up a pool of threads + * from which the io_context may execute handlers. All threads that are + * waiting in the pool are equivalent and the io_context may choose any one + * of them to invoke a handler. + * + * A normal exit from the run() function implies that the io_context object + * is stopped (the stopped() function returns @c true). Subsequent calls to + * run(), run_one(), poll() or poll_one() will return immediately unless there + * is a prior call to restart(). + * + * @return The number of handlers that were executed. + * + * @throws asio::system_error Thrown on failure. + * + * @note The run() function must not be called from a thread that is currently + * calling one of run(), run_one(), poll() or poll_one() on the same + * io_context object. + * + * The poll() function may also be used to dispatch ready handlers, but + * without blocking. + */ + ASIO_DECL std::size_t run(); + + /// Run the io_context object's event processing loop. + /** + * The run() function blocks until all work has finished and there are no + * more handlers to be dispatched, or until the io_context has been stopped. + * + * Multiple threads may call the run() function to set up a pool of threads + * from which the io_context may execute handlers. All threads that are + * waiting in the pool are equivalent and the io_context may choose any one + * of them to invoke a handler. + * + * A normal exit from the run() function implies that the io_context object + * is stopped (the stopped() function returns @c true). Subsequent calls to + * run(), run_one(), poll() or poll_one() will return immediately unless there + * is a prior call to restart(). + * + * @param ec Set to indicate what error occurred, if any. + * + * @return The number of handlers that were executed. + * + * @note The run() function must not be called from a thread that is currently + * calling one of run(), run_one(), poll() or poll_one() on the same + * io_context object. + * + * The poll() function may also be used to dispatch ready handlers, but + * without blocking. + */ + ASIO_DECL std::size_t run(asio::error_code& ec); + + /// Run the io_context object's event processing loop to execute at most one + /// handler. + /** + * The run_one() function blocks until one handler has been dispatched, or + * until the io_context has been stopped. + * + * @return The number of handlers that were executed. A zero return value + * implies that the io_context object is stopped (the stopped() function + * returns @c true). Subsequent calls to run(), run_one(), poll() or + * poll_one() will return immediately unless there is a prior call to + * restart(). + * + * @throws asio::system_error Thrown on failure. + */ + ASIO_DECL std::size_t run_one(); + + /// Run the io_context object's event processing loop to execute at most one + /// handler. + /** + * The run_one() function blocks until one handler has been dispatched, or + * until the io_context has been stopped. + * + * @return The number of handlers that were executed. A zero return value + * implies that the io_context object is stopped (the stopped() function + * returns @c true). Subsequent calls to run(), run_one(), poll() or + * poll_one() will return immediately unless there is a prior call to + * restart(). + * + * @return The number of handlers that were executed. + */ + ASIO_DECL std::size_t run_one(asio::error_code& ec); + + /// Run the io_context object's event processing loop to execute ready + /// handlers. + /** + * The poll() function runs handlers that are ready to run, without blocking, + * until the io_context has been stopped or there are no more ready handlers. + * + * @return The number of handlers that were executed. + * + * @throws asio::system_error Thrown on failure. + */ + ASIO_DECL std::size_t poll(); + + /// Run the io_context object's event processing loop to execute ready + /// handlers. + /** + * The poll() function runs handlers that are ready to run, without blocking, + * until the io_context has been stopped or there are no more ready handlers. + * + * @param ec Set to indicate what error occurred, if any. + * + * @return The number of handlers that were executed. + */ + ASIO_DECL std::size_t poll(asio::error_code& ec); + + /// Run the io_context object's event processing loop to execute one ready + /// handler. + /** + * The poll_one() function runs at most one handler that is ready to run, + * without blocking. + * + * @return The number of handlers that were executed. + * + * @throws asio::system_error Thrown on failure. + */ + ASIO_DECL std::size_t poll_one(); + + /// Run the io_context object's event processing loop to execute one ready + /// handler. + /** + * The poll_one() function runs at most one handler that is ready to run, + * without blocking. + * + * @param ec Set to indicate what error occurred, if any. + * + * @return The number of handlers that were executed. + */ + ASIO_DECL std::size_t poll_one(asio::error_code& ec); + + /// Stop the io_context object's event processing loop. + /** + * This function does not block, but instead simply signals the io_context to + * stop. All invocations of its run() or run_one() member functions should + * return as soon as possible. Subsequent calls to run(), run_one(), poll() + * or poll_one() will return immediately until restart() is called. + */ + ASIO_DECL void stop(); + + /// Determine whether the io_context object has been stopped. + /** + * This function is used to determine whether an io_context object has been + * stopped, either through an explicit call to stop(), or due to running out + * of work. When an io_context object is stopped, calls to run(), run_one(), + * poll() or poll_one() will return immediately without invoking any + * handlers. + * + * @return @c true if the io_context object is stopped, otherwise @c false. + */ + ASIO_DECL bool stopped() const; + + /// Restart the io_context in preparation for a subsequent run() invocation. + /** + * This function must be called prior to any second or later set of + * invocations of the run(), run_one(), poll() or poll_one() functions when a + * previous invocation of these functions returned due to the io_context + * being stopped or running out of work. After a call to restart(), the + * io_context object's stopped() function will return @c false. + * + * This function must not be called while there are any unfinished calls to + * the run(), run_one(), poll() or poll_one() functions. + */ + ASIO_DECL void restart(); + +#if !defined(ASIO_NO_DEPRECATED) + /// (Deprecated: Use restart().) Reset the io_context in preparation for a + /// subsequent run() invocation. + /** + * This function must be called prior to any second or later set of + * invocations of the run(), run_one(), poll() or poll_one() functions when a + * previous invocation of these functions returned due to the io_context + * being stopped or running out of work. After a call to restart(), the + * io_context object's stopped() function will return @c false. + * + * This function must not be called while there are any unfinished calls to + * the run(), run_one(), poll() or poll_one() functions. + */ + void reset(); + + /// (Deprecated: Use asio::dispatch().) Request the io_context to + /// invoke the given handler. + /** + * This function is used to ask the io_context to execute the given handler. + * + * The io_context guarantees that the handler will only be called in a thread + * in which the run(), run_one(), poll() or poll_one() member functions is + * currently being invoked. The handler may be executed inside this function + * if the guarantee can be met. + * + * @param handler The handler to be called. The io_context will make + * a copy of the handler object as required. The function signature of the + * handler must be: @code void handler(); @endcode + * + * @note This function throws an exception only if: + * + * @li the handler's @c asio_handler_allocate function; or + * + * @li the handler's copy constructor + * + * throws an exception. + */ + template + ASIO_INITFN_RESULT_TYPE(CompletionHandler, void ()) + dispatch(ASIO_MOVE_ARG(CompletionHandler) handler); + + /// (Deprecated: Use asio::post().) Request the io_context to invoke + /// the given handler and return immediately. + /** + * This function is used to ask the io_context to execute the given handler, + * but without allowing the io_context to call the handler from inside this + * function. + * + * The io_context guarantees that the handler will only be called in a thread + * in which the run(), run_one(), poll() or poll_one() member functions is + * currently being invoked. + * + * @param handler The handler to be called. The io_context will make + * a copy of the handler object as required. The function signature of the + * handler must be: @code void handler(); @endcode + * + * @note This function throws an exception only if: + * + * @li the handler's @c asio_handler_allocate function; or + * + * @li the handler's copy constructor + * + * throws an exception. + */ + template + ASIO_INITFN_RESULT_TYPE(CompletionHandler, void ()) + post(ASIO_MOVE_ARG(CompletionHandler) handler); + + /// (Deprecated: Use asio::bind_executor().) Create a new handler that + /// automatically dispatches the wrapped handler on the io_context. + /** + * This function is used to create a new handler function object that, when + * invoked, will automatically pass the wrapped handler to the io_context + * object's dispatch function. + * + * @param handler The handler to be wrapped. The io_context will make a copy + * of the handler object as required. The function signature of the handler + * must be: @code void handler(A1 a1, ... An an); @endcode + * + * @return A function object that, when invoked, passes the wrapped handler to + * the io_context object's dispatch function. Given a function object with the + * signature: + * @code R f(A1 a1, ... An an); @endcode + * If this function object is passed to the wrap function like so: + * @code io_context.wrap(f); @endcode + * then the return value is a function object with the signature + * @code void g(A1 a1, ... An an); @endcode + * that, when invoked, executes code equivalent to: + * @code io_context.dispatch(boost::bind(f, a1, ... an)); @endcode + */ + template +#if defined(GENERATING_DOCUMENTATION) + unspecified +#else + detail::wrapped_handler +#endif + wrap(Handler handler); +#endif // !defined(ASIO_NO_DEPRECATED) + +private: + // Helper function to create the implementation. + ASIO_DECL impl_type& create_impl(std::size_t concurrency_hint = 0); + + // Backwards compatible overload for use with services derived from + // io_context::service. + template + friend Service& use_service(io_context& ioc); + +#if defined(ASIO_WINDOWS) || defined(__CYGWIN__) + detail::winsock_init<> init_; +#elif defined(__sun) || defined(__QNX__) || defined(__hpux) || defined(_AIX) \ + || defined(__osf__) + detail::signal_init<> init_; +#endif + + // The implementation. + impl_type& impl_; +}; + +/// Executor used to submit functions to an io_context. +class io_context::executor_type +{ +public: + /// Obtain the underlying execution context. + io_context& context() ASIO_NOEXCEPT; + + /// Inform the io_context that it has some outstanding work to do. + /** + * This function is used to inform the io_context that some work has begun. + * This ensures that the io_context's run() and run_one() functions do not + * exit while the work is underway. + */ + void on_work_started() ASIO_NOEXCEPT; + + /// Inform the io_context that some work is no longer outstanding. + /** + * This function is used to inform the io_context that some work has + * finished. Once the count of unfinished work reaches zero, the io_context + * is stopped and the run() and run_one() functions may exit. + */ + void on_work_finished() ASIO_NOEXCEPT; + + /// Request the io_context to invoke the given function object. + /** + * This function is used to ask the io_context to execute the given function + * object. If the current thread is running the io_context, @c dispatch() + * executes the function before returning. Otherwise, the function will be + * scheduled to run on the io_context. + * + * @param f The function object to be called. The executor will make a copy + * of the handler object as required. The function signature of the function + * object must be: @code void function(); @endcode + * + * @param a An allocator that may be used by the executor to allocate the + * internal storage needed for function invocation. + */ + template + void dispatch(ASIO_MOVE_ARG(Function) f, const Allocator& a); + + /// Request the io_context to invoke the given function object. + /** + * This function is used to ask the io_context to execute the given function + * object. The function object will never be executed inside @c post(). + * Instead, it will be scheduled to run on the io_context. + * + * @param f The function object to be called. The executor will make a copy + * of the handler object as required. The function signature of the function + * object must be: @code void function(); @endcode + * + * @param a An allocator that may be used by the executor to allocate the + * internal storage needed for function invocation. + */ + template + void post(ASIO_MOVE_ARG(Function) f, const Allocator& a); + + /// Request the io_context to invoke the given function object. + /** + * This function is used to ask the io_context to execute the given function + * object. The function object will never be executed inside @c defer(). + * Instead, it will be scheduled to run on the io_context. + * + * If the current thread belongs to the io_context, @c defer() will delay + * scheduling the function object until the current thread returns control to + * the pool. + * + * @param f The function object to be called. The executor will make a copy + * of the handler object as required. The function signature of the function + * object must be: @code void function(); @endcode + * + * @param a An allocator that may be used by the executor to allocate the + * internal storage needed for function invocation. + */ + template + void defer(ASIO_MOVE_ARG(Function) f, const Allocator& a); + + /// Determine whether the io_context is running in the current thread. + /** + * @return @c true if the current thread is running the io_context. Otherwise + * returns @c false. + */ + bool running_in_this_thread() const ASIO_NOEXCEPT; + + /// Compare two executors for equality. + /** + * Two executors are equal if they refer to the same underlying io_context. + */ + friend bool operator==(const executor_type& a, + const executor_type& b) ASIO_NOEXCEPT + { + return &a.io_context_ == &b.io_context_; + } + + /// Compare two executors for inequality. + /** + * Two executors are equal if they refer to the same underlying io_context. + */ + friend bool operator!=(const executor_type& a, + const executor_type& b) ASIO_NOEXCEPT + { + return &a.io_context_ != &b.io_context_; + } + +private: + friend class io_context; + + // Constructor. + explicit executor_type(io_context& i) : io_context_(i) {} + + // The underlying io_context. + io_context& io_context_; +}; + +#if !defined(GENERATING_DOCUMENTATION) +template <> struct is_executor : true_type {}; +#endif // !defined(GENERATING_DOCUMENTATION) + + +/// (Deprecated: Use executor_work_guard.) Class to inform the io_context when +/// it has work to do. +/** + * The work class is used to inform the io_context when work starts and + * finishes. This ensures that the io_context object's run() function will not + * exit while work is underway, and that it does exit when there is no + * unfinished work remaining. + * + * The work class is copy-constructible so that it may be used as a data member + * in a handler class. It is not assignable. + */ +class io_context::work +{ +public: + /// Constructor notifies the io_context that work is starting. + /** + * The constructor is used to inform the io_context that some work has begun. + * This ensures that the io_context object's run() function will not exit + * while the work is underway. + */ + explicit work(asio::io_context& io_context); + + /// Copy constructor notifies the io_context that work is starting. + /** + * The constructor is used to inform the io_context that some work has begun. + * This ensures that the io_context object's run() function will not exit + * while the work is underway. + */ + work(const work& other); + + /// Destructor notifies the io_context that the work is complete. + /** + * The destructor is used to inform the io_context that some work has + * finished. Once the count of unfinished work reaches zero, the io_context + * object's run() function is permitted to exit. + */ + ~work(); + + /// Get the io_context associated with the work. + asio::io_context& get_io_context(); + +#if !defined(ASIO_NO_DEPRECATED) + /// (Deprecated: Use get_io_context().) Get the io_context associated with the + /// work. + asio::io_context& get_io_service(); +#endif // !defined(ASIO_NO_DEPRECATED) + +private: + // Prevent assignment. + void operator=(const work& other); + + // The io_context implementation. + detail::io_context_impl& io_context_impl_; +}; + +/// Base class for all io_context services. +class io_context::service + : public execution_context::service +{ +public: + /// Get the io_context object that owns the service. + asio::io_context& get_io_context(); + +#if !defined(ASIO_NO_DEPRECATED) + /// Get the io_context object that owns the service. + asio::io_context& get_io_service(); +#endif // !defined(ASIO_NO_DEPRECATED) + +protected: + /// Constructor. + /** + * @param owner The io_context object that owns the service. + */ + ASIO_DECL service(asio::io_context& owner); + + /// Destructor. + ASIO_DECL virtual ~service(); +}; + +namespace detail { + +// Special service base class to keep classes header-file only. +template +class service_base + : public asio::io_context::service +{ +public: + static asio::detail::service_id id; + + // Constructor. + service_base(asio::io_context& io_context) + : asio::io_context::service(io_context) + { + } +}; + +template +asio::detail::service_id service_base::id; + +} // namespace detail +} // namespace asio + +#include "asio/detail/pop_options.hpp" + +#include "asio/impl/io_context.hpp" +#if defined(ASIO_HEADER_ONLY) +# include "asio/impl/io_context.ipp" +#endif // defined(ASIO_HEADER_ONLY) + +// If both io_context.hpp and strand.hpp have been included, automatically +// include the header file needed for the io_context::strand class. +#if defined(ASIO_STRAND_HPP) +# include "asio/io_context_strand.hpp" +#endif // defined(ASIO_STRAND_HPP) + +#endif // ASIO_IO_CONTEXT_HPP diff --git a/asio/include/asio/io_context_strand.hpp b/asio/include/asio/io_context_strand.hpp new file mode 100644 index 00000000..8fe6c14f --- /dev/null +++ b/asio/include/asio/io_context_strand.hpp @@ -0,0 +1,382 @@ +// +// io_context_strand.hpp +// ~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef ASIO_IO_CONTEXT_STRAND_HPP +#define ASIO_IO_CONTEXT_STRAND_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include "asio/detail/config.hpp" +#include "asio/async_result.hpp" +#include "asio/detail/handler_type_requirements.hpp" +#include "asio/detail/strand_service.hpp" +#include "asio/detail/wrapped_handler.hpp" +#include "asio/io_context.hpp" + +#include "asio/detail/push_options.hpp" + +namespace asio { + +/// Provides serialised handler execution. +/** + * The io_context::strand class provides the ability to post and dispatch + * handlers with the guarantee that none of those handlers will execute + * concurrently. + * + * @par Order of handler invocation + * Given: + * + * @li a strand object @c s + * + * @li an object @c a meeting completion handler requirements + * + * @li an object @c a1 which is an arbitrary copy of @c a made by the + * implementation + * + * @li an object @c b meeting completion handler requirements + * + * @li an object @c b1 which is an arbitrary copy of @c b made by the + * implementation + * + * if any of the following conditions are true: + * + * @li @c s.post(a) happens-before @c s.post(b) + * + * @li @c s.post(a) happens-before @c s.dispatch(b), where the latter is + * performed outside the strand + * + * @li @c s.dispatch(a) happens-before @c s.post(b), where the former is + * performed outside the strand + * + * @li @c s.dispatch(a) happens-before @c s.dispatch(b), where both are + * performed outside the strand + * + * then @c asio_handler_invoke(a1, &a1) happens-before + * @c asio_handler_invoke(b1, &b1). + * + * Note that in the following case: + * @code async_op_1(..., s.wrap(a)); + * async_op_2(..., s.wrap(b)); @endcode + * the completion of the first async operation will perform @c s.dispatch(a), + * and the second will perform @c s.dispatch(b), but the order in which those + * are performed is unspecified. That is, you cannot state whether one + * happens-before the other. Therefore none of the above conditions are met and + * no ordering guarantee is made. + * + * @note The implementation makes no guarantee that handlers posted or + * dispatched through different @c strand objects will be invoked concurrently. + * + * @par Thread Safety + * @e Distinct @e objects: Safe.@n + * @e Shared @e objects: Safe. + * + * @par Concepts: + * Dispatcher. + */ +class io_context::strand +{ +public: + /// Constructor. + /** + * Constructs the strand. + * + * @param io_context The io_context object that the strand will use to + * dispatch handlers that are ready to be run. + */ + explicit strand(asio::io_context& io_context) + : service_(asio::use_service< + asio::detail::strand_service>(io_context)) + { + service_.construct(impl_); + } + + /// Destructor. + /** + * Destroys a strand. + * + * Handlers posted through the strand that have not yet been invoked will + * still be dispatched in a way that meets the guarantee of non-concurrency. + */ + ~strand() + { + } + +#if !defined(ASIO_NO_DEPRECATED) + /// (Deprecated: Use context().) Get the io_context associated with the + /// strand. + /** + * This function may be used to obtain the io_context object that the strand + * uses to dispatch handlers for asynchronous operations. + * + * @return A reference to the io_context object that the strand will use to + * dispatch handlers. Ownership is not transferred to the caller. + */ + asio::io_context& get_io_context() + { + return service_.get_io_context(); + } + + /// (Deprecated: Use context().) Get the io_context associated with the + /// strand. + /** + * This function may be used to obtain the io_context object that the strand + * uses to dispatch handlers for asynchronous operations. + * + * @return A reference to the io_context object that the strand will use to + * dispatch handlers. Ownership is not transferred to the caller. + */ + asio::io_context& get_io_service() + { + return service_.get_io_context(); + } +#endif // !defined(ASIO_NO_DEPRECATED) + + /// Obtain the underlying execution context. + asio::io_context& context() ASIO_NOEXCEPT + { + return service_.get_io_context(); + } + + /// Inform the strand that it has some outstanding work to do. + /** + * The strand delegates this call to its underlying io_context. + */ + void on_work_started() ASIO_NOEXCEPT + { + context().get_executor().on_work_started(); + } + + /// Inform the strand that some work is no longer outstanding. + /** + * The strand delegates this call to its underlying io_context. + */ + void on_work_finished() ASIO_NOEXCEPT + { + context().get_executor().on_work_finished(); + } + + /// Request the strand to invoke the given function object. + /** + * This function is used to ask the strand to execute the given function + * object on its underlying io_context. The function object will be executed + * inside this function if the strand is not otherwise busy and if the + * underlying io_context's executor's @c dispatch() function is also able to + * execute the function before returning. + * + * @param f The function object to be called. The executor will make + * a copy of the handler object as required. The function signature of the + * function object must be: @code void function(); @endcode + * + * @param a An allocator that may be used by the executor to allocate the + * internal storage needed for function invocation. + */ + template + void dispatch(ASIO_MOVE_ARG(Function) f, const Allocator& a) + { + typename decay::type tmp(ASIO_MOVE_CAST(Function)(f)); + service_.dispatch(impl_, tmp); + (void)a; + } + +#if !defined(ASIO_NO_DEPRECATED) + /// (Deprecated: Use asio::dispatch().) Request the strand to invoke + /// the given handler. + /** + * This function is used to ask the strand to execute the given handler. + * + * The strand object guarantees that handlers posted or dispatched through + * the strand will not be executed concurrently. The handler may be executed + * inside this function if the guarantee can be met. If this function is + * called from within a handler that was posted or dispatched through the same + * strand, then the new handler will be executed immediately. + * + * The strand's guarantee is in addition to the guarantee provided by the + * underlying io_context. The io_context guarantees that the handler will only + * be called in a thread in which the io_context's run member function is + * currently being invoked. + * + * @param handler The handler to be called. The strand will make a copy of the + * handler object as required. The function signature of the handler must be: + * @code void handler(); @endcode + */ + template + ASIO_INITFN_RESULT_TYPE(CompletionHandler, void ()) + dispatch(ASIO_MOVE_ARG(CompletionHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a CompletionHandler. + ASIO_COMPLETION_HANDLER_CHECK(CompletionHandler, handler) type_check; + + async_completion init(handler); + + service_.dispatch(impl_, init.handler); + + return init.result.get(); + } +#endif // !defined(ASIO_NO_DEPRECATED) + + /// Request the strand to invoke the given function object. + /** + * This function is used to ask the executor to execute the given function + * object. The function object will never be executed inside this function. + * Instead, it will be scheduled to run by the underlying io_context. + * + * @param f The function object to be called. The executor will make + * a copy of the handler object as required. The function signature of the + * function object must be: @code void function(); @endcode + * + * @param a An allocator that may be used by the executor to allocate the + * internal storage needed for function invocation. + */ + template + void post(ASIO_MOVE_ARG(Function) f, const Allocator& a) + { + typename decay::type tmp(ASIO_MOVE_CAST(Function)(f)); + service_.post(impl_, tmp); + (void)a; + } + +#if !defined(ASIO_NO_DEPRECATED) + /// (Deprecated: Use asio::post().) Request the strand to invoke the + /// given handler and return immediately. + /** + * This function is used to ask the strand to execute the given handler, but + * without allowing the strand to call the handler from inside this function. + * + * The strand object guarantees that handlers posted or dispatched through + * the strand will not be executed concurrently. The strand's guarantee is in + * addition to the guarantee provided by the underlying io_context. The + * io_context guarantees that the handler will only be called in a thread in + * which the io_context's run member function is currently being invoked. + * + * @param handler The handler to be called. The strand will make a copy of the + * handler object as required. The function signature of the handler must be: + * @code void handler(); @endcode + */ + template + ASIO_INITFN_RESULT_TYPE(CompletionHandler, void ()) + post(ASIO_MOVE_ARG(CompletionHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a CompletionHandler. + ASIO_COMPLETION_HANDLER_CHECK(CompletionHandler, handler) type_check; + + async_completion init(handler); + + service_.post(impl_, init.handler); + + return init.result.get(); + } +#endif // !defined(ASIO_NO_DEPRECATED) + + /// Request the strand to invoke the given function object. + /** + * This function is used to ask the executor to execute the given function + * object. The function object will never be executed inside this function. + * Instead, it will be scheduled to run by the underlying io_context. + * + * @param f The function object to be called. The executor will make + * a copy of the handler object as required. The function signature of the + * function object must be: @code void function(); @endcode + * + * @param a An allocator that may be used by the executor to allocate the + * internal storage needed for function invocation. + */ + template + void defer(ASIO_MOVE_ARG(Function) f, const Allocator& a) + { + typename decay::type tmp(ASIO_MOVE_CAST(Function)(f)); + service_.post(impl_, tmp); + (void)a; + } + +#if !defined(ASIO_NO_DEPRECATED) + /// (Deprecated: Use asio::bind_executor().) Create a new handler that + /// automatically dispatches the wrapped handler on the strand. + /** + * This function is used to create a new handler function object that, when + * invoked, will automatically pass the wrapped handler to the strand's + * dispatch function. + * + * @param handler The handler to be wrapped. The strand will make a copy of + * the handler object as required. The function signature of the handler must + * be: @code void handler(A1 a1, ... An an); @endcode + * + * @return A function object that, when invoked, passes the wrapped handler to + * the strand's dispatch function. Given a function object with the signature: + * @code R f(A1 a1, ... An an); @endcode + * If this function object is passed to the wrap function like so: + * @code strand.wrap(f); @endcode + * then the return value is a function object with the signature + * @code void g(A1 a1, ... An an); @endcode + * that, when invoked, executes code equivalent to: + * @code strand.dispatch(boost::bind(f, a1, ... an)); @endcode + */ + template +#if defined(GENERATING_DOCUMENTATION) + unspecified +#else + detail::wrapped_handler +#endif + wrap(Handler handler) + { + return detail::wrapped_handler(*this, handler); + } +#endif // !defined(ASIO_NO_DEPRECATED) + + /// Determine whether the strand is running in the current thread. + /** + * @return @c true if the current thread is executing a handler that was + * submitted to the strand using post(), dispatch() or wrap(). Otherwise + * returns @c false. + */ + bool running_in_this_thread() const ASIO_NOEXCEPT + { + return service_.running_in_this_thread(impl_); + } + + /// Compare two strands for equality. + /** + * Two strands are equal if they refer to the same ordered, non-concurrent + * state. + */ + friend bool operator==(const strand& a, const strand& b) ASIO_NOEXCEPT + { + return a.impl_ == b.impl_; + } + + /// Compare two strands for inequality. + /** + * Two strands are equal if they refer to the same ordered, non-concurrent + * state. + */ + friend bool operator!=(const strand& a, const strand& b) ASIO_NOEXCEPT + { + return a.impl_ != b.impl_; + } + +private: + asio::detail::strand_service& service_; + asio::detail::strand_service::implementation_type impl_; +}; + +#if !defined(GENERATING_DOCUMENTATION) +template <> +struct is_executor : true_type {}; +#endif // !defined(GENERATING_DOCUMENTATION) + +} // namespace asio + +#include "asio/detail/pop_options.hpp" + +#endif // ASIO_IO_CONTEXT_STRAND_HPP diff --git a/asio/include/asio/io_service.hpp b/asio/include/asio/io_service.hpp index a487d0cf..4eb7cc55 100644 --- a/asio/include/asio/io_service.hpp +++ b/asio/include/asio/io_service.hpp @@ -15,709 +15,17 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include "asio/detail/config.hpp" -#include -#include -#include -#include "asio/async_result.hpp" -#include "asio/detail/noncopyable.hpp" -#include "asio/detail/wrapped_handler.hpp" -#include "asio/error_code.hpp" -#include "asio/execution_context.hpp" -#include "asio/is_executor.hpp" - -#if defined(ASIO_WINDOWS) || defined(__CYGWIN__) -# include "asio/detail/winsock_init.hpp" -#elif defined(__sun) || defined(__QNX__) || defined(__hpux) || defined(_AIX) \ - || defined(__osf__) -# include "asio/detail/signal_init.hpp" -#endif +#include "asio/io_context.hpp" #include "asio/detail/push_options.hpp" namespace asio { -namespace detail { -#if defined(ASIO_HAS_IOCP) - typedef class win_iocp_io_service io_service_impl; - class win_iocp_overlapped_ptr; -#else - typedef class scheduler io_service_impl; -#endif -} // namespace detail +/// Typedef for backwards compatibility. +typedef io_context io_service; -/// Provides core I/O functionality. -/** - * The io_service class provides the core I/O functionality for users of the - * asynchronous I/O objects, including: - * - * @li asio::ip::tcp::socket - * @li asio::ip::tcp::acceptor - * @li asio::ip::udp::socket - * @li asio::deadline_timer. - * - * The io_service class also includes facilities intended for developers of - * custom asynchronous services. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Safe, with the specific exceptions of the restart() and - * notify_fork() functions. Calling restart() while there are unfinished run(), - * run_one(), poll() or poll_one() calls results in undefined behaviour. The - * notify_fork() function should not be called while any io_service function, - * or any function on an I/O object that is associated with the io_service, is - * being called in another thread. - * - * @par Concepts: - * Dispatcher. - * - * @par Synchronous and asynchronous operations - * - * Synchronous operations on I/O objects implicitly run the io_service object - * for an individual operation. The io_service functions run(), run_one(), - * poll() or poll_one() must be called for the io_service to perform - * asynchronous operations on behalf of a C++ program. Notification that an - * asynchronous operation has completed is delivered by invocation of the - * associated handler. Handlers are invoked only by a thread that is currently - * calling any overload of run(), run_one(), poll() or poll_one() for the - * io_service. - * - * @par Effect of exceptions thrown from handlers - * - * If an exception is thrown from a handler, the exception is allowed to - * propagate through the throwing thread's invocation of run(), run_one(), - * poll() or poll_one(). No other threads that are calling any of these - * functions are affected. It is then the responsibility of the application to - * catch the exception. - * - * After the exception has been caught, the run(), run_one(), poll() or - * poll_one() call may be restarted @em without the need for an intervening - * call to restart(). This allows the thread to rejoin the io_service object's - * thread pool without impacting any other threads in the pool. - * - * For example: - * - * @code - * asio::io_service io_service; - * ... - * for (;;) - * { - * try - * { - * io_service.run(); - * break; // run() exited normally - * } - * catch (my_exception& e) - * { - * // Deal with exception as appropriate. - * } - * } - * @endcode - * - * @par Stopping the io_service from running out of work - * - * Some applications may need to prevent an io_service object's run() call from - * returning when there is no more work to do. For example, the io_service may - * be being run in a background thread that is launched prior to the - * application's asynchronous operations. The run() call may be kept running by - * creating an object of type asio::io_service::work: - * - * @code asio::io_service io_service; - * asio::io_service::work work(io_service); - * ... @endcode - * - * To effect a shutdown, the application will then need to call the io_service - * object's stop() member function. This will cause the io_service run() call - * to return as soon as possible, abandoning unfinished operations and without - * permitting ready handlers to be dispatched. - * - * Alternatively, if the application requires that all operations and handlers - * be allowed to finish normally, the work object may be explicitly destroyed. - * - * @code asio::io_service io_service; - * auto_ptr work( - * new asio::io_service::work(io_service)); - * ... - * work.reset(); // Allow run() to exit. @endcode - */ -class io_service - : public execution_context -{ -private: - typedef detail::io_service_impl impl_type; -#if defined(ASIO_HAS_IOCP) - friend class detail::win_iocp_overlapped_ptr; -#endif - -public: - class executor_type; - friend class executor_type; - - class work; - friend class work; - - class service; - - class strand; - - /// Constructor. - ASIO_DECL io_service(); - - /// Constructor. - /** - * Construct with a hint about the required level of concurrency. - * - * @param concurrency_hint A suggestion to the implementation on how many - * threads it should allow to run simultaneously. - */ - ASIO_DECL explicit io_service(std::size_t concurrency_hint); - - /// Destructor. - /** - * On destruction, the io_service performs the following sequence of - * operations: - * - * @li For each service object @c svc in the io_service set, in reverse order - * of the beginning of service object lifetime, performs - * @c svc->shutdown_service(). - * - * @li Uninvoked handler objects that were scheduled for deferred invocation - * on the io_service, or any associated strand, are destroyed. - * - * @li For each service object @c svc in the io_service set, in reverse order - * of the beginning of service object lifetime, performs - * delete static_cast(svc). - * - * @note The destruction sequence described above permits programs to - * simplify their resource management by using @c shared_ptr<>. Where an - * object's lifetime is tied to the lifetime of a connection (or some other - * sequence of asynchronous operations), a @c shared_ptr to the object would - * be bound into the handlers for all asynchronous operations associated with - * it. This works as follows: - * - * @li When a single connection ends, all associated asynchronous operations - * complete. The corresponding handler objects are destroyed, and all - * @c shared_ptr references to the objects are destroyed. - * - * @li To shut down the whole program, the io_service function stop() is - * called to terminate any run() calls as soon as possible. The io_service - * destructor defined above destroys all handlers, causing all @c shared_ptr - * references to all connection objects to be destroyed. - */ - ASIO_DECL ~io_service(); - - /// Obtains the executor associated with the io_service. - executor_type get_executor() ASIO_NOEXCEPT; - - /// Run the io_service object's event processing loop. - /** - * The run() function blocks until all work has finished and there are no - * more handlers to be dispatched, or until the io_service has been stopped. - * - * Multiple threads may call the run() function to set up a pool of threads - * from which the io_service may execute handlers. All threads that are - * waiting in the pool are equivalent and the io_service may choose any one - * of them to invoke a handler. - * - * A normal exit from the run() function implies that the io_service object - * is stopped (the stopped() function returns @c true). Subsequent calls to - * run(), run_one(), poll() or poll_one() will return immediately unless there - * is a prior call to restart(). - * - * @return The number of handlers that were executed. - * - * @throws asio::system_error Thrown on failure. - * - * @note The run() function must not be called from a thread that is currently - * calling one of run(), run_one(), poll() or poll_one() on the same - * io_service object. - * - * The poll() function may also be used to dispatch ready handlers, but - * without blocking. - */ - ASIO_DECL std::size_t run(); - - /// Run the io_service object's event processing loop. - /** - * The run() function blocks until all work has finished and there are no - * more handlers to be dispatched, or until the io_service has been stopped. - * - * Multiple threads may call the run() function to set up a pool of threads - * from which the io_service may execute handlers. All threads that are - * waiting in the pool are equivalent and the io_service may choose any one - * of them to invoke a handler. - * - * A normal exit from the run() function implies that the io_service object - * is stopped (the stopped() function returns @c true). Subsequent calls to - * run(), run_one(), poll() or poll_one() will return immediately unless there - * is a prior call to restart(). - * - * @param ec Set to indicate what error occurred, if any. - * - * @return The number of handlers that were executed. - * - * @note The run() function must not be called from a thread that is currently - * calling one of run(), run_one(), poll() or poll_one() on the same - * io_service object. - * - * The poll() function may also be used to dispatch ready handlers, but - * without blocking. - */ - ASIO_DECL std::size_t run(asio::error_code& ec); - - /// Run the io_service object's event processing loop to execute at most one - /// handler. - /** - * The run_one() function blocks until one handler has been dispatched, or - * until the io_service has been stopped. - * - * @return The number of handlers that were executed. A zero return value - * implies that the io_service object is stopped (the stopped() function - * returns @c true). Subsequent calls to run(), run_one(), poll() or - * poll_one() will return immediately unless there is a prior call to - * restart(). - * - * @throws asio::system_error Thrown on failure. - */ - ASIO_DECL std::size_t run_one(); - - /// Run the io_service object's event processing loop to execute at most one - /// handler. - /** - * The run_one() function blocks until one handler has been dispatched, or - * until the io_service has been stopped. - * - * @return The number of handlers that were executed. A zero return value - * implies that the io_service object is stopped (the stopped() function - * returns @c true). Subsequent calls to run(), run_one(), poll() or - * poll_one() will return immediately unless there is a prior call to - * restart(). - * - * @return The number of handlers that were executed. - */ - ASIO_DECL std::size_t run_one(asio::error_code& ec); - - /// Run the io_service object's event processing loop to execute ready - /// handlers. - /** - * The poll() function runs handlers that are ready to run, without blocking, - * until the io_service has been stopped or there are no more ready handlers. - * - * @return The number of handlers that were executed. - * - * @throws asio::system_error Thrown on failure. - */ - ASIO_DECL std::size_t poll(); - - /// Run the io_service object's event processing loop to execute ready - /// handlers. - /** - * The poll() function runs handlers that are ready to run, without blocking, - * until the io_service has been stopped or there are no more ready handlers. - * - * @param ec Set to indicate what error occurred, if any. - * - * @return The number of handlers that were executed. - */ - ASIO_DECL std::size_t poll(asio::error_code& ec); - - /// Run the io_service object's event processing loop to execute one ready - /// handler. - /** - * The poll_one() function runs at most one handler that is ready to run, - * without blocking. - * - * @return The number of handlers that were executed. - * - * @throws asio::system_error Thrown on failure. - */ - ASIO_DECL std::size_t poll_one(); - - /// Run the io_service object's event processing loop to execute one ready - /// handler. - /** - * The poll_one() function runs at most one handler that is ready to run, - * without blocking. - * - * @param ec Set to indicate what error occurred, if any. - * - * @return The number of handlers that were executed. - */ - ASIO_DECL std::size_t poll_one(asio::error_code& ec); - - /// Stop the io_service object's event processing loop. - /** - * This function does not block, but instead simply signals the io_service to - * stop. All invocations of its run() or run_one() member functions should - * return as soon as possible. Subsequent calls to run(), run_one(), poll() - * or poll_one() will return immediately until restart() is called. - */ - ASIO_DECL void stop(); - - /// Determine whether the io_service object has been stopped. - /** - * This function is used to determine whether an io_service object has been - * stopped, either through an explicit call to stop(), or due to running out - * of work. When an io_service object is stopped, calls to run(), run_one(), - * poll() or poll_one() will return immediately without invoking any - * handlers. - * - * @return @c true if the io_service object is stopped, otherwise @c false. - */ - ASIO_DECL bool stopped() const; - - /// Restart the io_service in preparation for a subsequent run() invocation. - /** - * This function must be called prior to any second or later set of - * invocations of the run(), run_one(), poll() or poll_one() functions when a - * previous invocation of these functions returned due to the io_service - * being stopped or running out of work. After a call to restart(), the - * io_service object's stopped() function will return @c false. - * - * This function must not be called while there are any unfinished calls to - * the run(), run_one(), poll() or poll_one() functions. - */ - ASIO_DECL void restart(); - -#if !defined(ASIO_NO_DEPRECATED) - /// (Deprecated: Use restart().) Reset the io_service in preparation for a - /// subsequent run() invocation. - /** - * This function must be called prior to any second or later set of - * invocations of the run(), run_one(), poll() or poll_one() functions when a - * previous invocation of these functions returned due to the io_service - * being stopped or running out of work. After a call to restart(), the - * io_service object's stopped() function will return @c false. - * - * This function must not be called while there are any unfinished calls to - * the run(), run_one(), poll() or poll_one() functions. - */ - void reset(); - - /// (Deprecated: Use asio::dispatch().) Request the io_service to - /// invoke the given handler. - /** - * This function is used to ask the io_service to execute the given handler. - * - * The io_service guarantees that the handler will only be called in a thread - * in which the run(), run_one(), poll() or poll_one() member functions is - * currently being invoked. The handler may be executed inside this function - * if the guarantee can be met. - * - * @param handler The handler to be called. The io_service will make - * a copy of the handler object as required. The function signature of the - * handler must be: @code void handler(); @endcode - * - * @note This function throws an exception only if: - * - * @li the handler's @c asio_handler_allocate function; or - * - * @li the handler's copy constructor - * - * throws an exception. - */ - template - ASIO_INITFN_RESULT_TYPE(CompletionHandler, void ()) - dispatch(ASIO_MOVE_ARG(CompletionHandler) handler); - - /// (Deprecated: Use asio::post().) Request the io_service to invoke - /// the given handler and return immediately. - /** - * This function is used to ask the io_service to execute the given handler, - * but without allowing the io_service to call the handler from inside this - * function. - * - * The io_service guarantees that the handler will only be called in a thread - * in which the run(), run_one(), poll() or poll_one() member functions is - * currently being invoked. - * - * @param handler The handler to be called. The io_service will make - * a copy of the handler object as required. The function signature of the - * handler must be: @code void handler(); @endcode - * - * @note This function throws an exception only if: - * - * @li the handler's @c asio_handler_allocate function; or - * - * @li the handler's copy constructor - * - * throws an exception. - */ - template - ASIO_INITFN_RESULT_TYPE(CompletionHandler, void ()) - post(ASIO_MOVE_ARG(CompletionHandler) handler); - - /// (Deprecated: Use asio::bind_executor().) Create a new handler that - /// automatically dispatches the wrapped handler on the io_service. - /** - * This function is used to create a new handler function object that, when - * invoked, will automatically pass the wrapped handler to the io_service - * object's dispatch function. - * - * @param handler The handler to be wrapped. The io_service will make a copy - * of the handler object as required. The function signature of the handler - * must be: @code void handler(A1 a1, ... An an); @endcode - * - * @return A function object that, when invoked, passes the wrapped handler to - * the io_service object's dispatch function. Given a function object with the - * signature: - * @code R f(A1 a1, ... An an); @endcode - * If this function object is passed to the wrap function like so: - * @code io_service.wrap(f); @endcode - * then the return value is a function object with the signature - * @code void g(A1 a1, ... An an); @endcode - * that, when invoked, executes code equivalent to: - * @code io_service.dispatch(boost::bind(f, a1, ... an)); @endcode - */ - template -#if defined(GENERATING_DOCUMENTATION) - unspecified -#else - detail::wrapped_handler -#endif - wrap(Handler handler); -#endif // !defined(ASIO_NO_DEPRECATED) - -private: - // Helper function to create the implementation. - ASIO_DECL impl_type& create_impl(std::size_t concurrency_hint = 0); - - // Backwards compatible overload for use with services derived from - // io_service::service. - template - friend Service& use_service(io_service& ios); - -#if defined(ASIO_WINDOWS) || defined(__CYGWIN__) - detail::winsock_init<> init_; -#elif defined(__sun) || defined(__QNX__) || defined(__hpux) || defined(_AIX) \ - || defined(__osf__) - detail::signal_init<> init_; -#endif - - // The implementation. - impl_type& impl_; -}; - -/// Executor used to submit functions to an io_service. -class io_service::executor_type -{ -public: - /// Obtain the underlying execution context. - io_service& context() ASIO_NOEXCEPT; - - /// Inform the io_service that it has some outstanding work to do. - /** - * This function is used to inform the io_service that some work has begun. - * This ensures that the io_service's run() and run_one() functions do not - * exit while the work is underway. - */ - void on_work_started() ASIO_NOEXCEPT; - - /// Inform the io_service that some work is no longer outstanding. - /** - * This function is used to inform the io_service that some work has - * finished. Once the count of unfinished work reaches zero, the io_service - * is stopped and the run() and run_one() functions may exit. - */ - void on_work_finished() ASIO_NOEXCEPT; - - /// Request the io_service to invoke the given function object. - /** - * This function is used to ask the io_service to execute the given function - * object. If the current thread is running the io_service, @c dispatch() - * executes the function before returning. Otherwise, the function will be - * scheduled to run on the io_service. - * - * @param f The function object to be called. The executor will make a copy - * of the handler object as required. The function signature of the function - * object must be: @code void function(); @endcode - * - * @param a An allocator that may be used by the executor to allocate the - * internal storage needed for function invocation. - */ - template - void dispatch(ASIO_MOVE_ARG(Function) f, const Allocator& a); - - /// Request the io_service to invoke the given function object. - /** - * This function is used to ask the io_service to execute the given function - * object. The function object will never be executed inside @c post(). - * Instead, it will be scheduled to run on the io_service. - * - * @param f The function object to be called. The executor will make a copy - * of the handler object as required. The function signature of the function - * object must be: @code void function(); @endcode - * - * @param a An allocator that may be used by the executor to allocate the - * internal storage needed for function invocation. - */ - template - void post(ASIO_MOVE_ARG(Function) f, const Allocator& a); - - /// Request the io_service to invoke the given function object. - /** - * This function is used to ask the io_service to execute the given function - * object. The function object will never be executed inside @c defer(). - * Instead, it will be scheduled to run on the io_service. - * - * If the current thread belongs to the io_service, @c defer() will delay - * scheduling the function object until the current thread returns control to - * the pool. - * - * @param f The function object to be called. The executor will make a copy - * of the handler object as required. The function signature of the function - * object must be: @code void function(); @endcode - * - * @param a An allocator that may be used by the executor to allocate the - * internal storage needed for function invocation. - */ - template - void defer(ASIO_MOVE_ARG(Function) f, const Allocator& a); - - /// Determine whether the io_service is running in the current thread. - /** - * @return @c true if the current thread is running the io_service. Otherwise - * returns @c false. - */ - bool running_in_this_thread() const ASIO_NOEXCEPT; - - /// Compare two executors for equality. - /** - * Two executors are equal if they refer to the same underlying io_service. - */ - friend bool operator==(const executor_type& a, - const executor_type& b) ASIO_NOEXCEPT - { - return &a.io_service_ == &b.io_service_; - } - - /// Compare two executors for inequality. - /** - * Two executors are equal if they refer to the same underlying io_service. - */ - friend bool operator!=(const executor_type& a, - const executor_type& b) ASIO_NOEXCEPT - { - return &a.io_service_ != &b.io_service_; - } - -private: - friend class io_service; - - // Constructor. - explicit executor_type(io_service& i) : io_service_(i) {} - - // The underlying io_service. - io_service& io_service_; -}; - -#if !defined(GENERATING_DOCUMENTATION) -template <> struct is_executor : true_type {}; -#endif // !defined(GENERATING_DOCUMENTATION) - - -/// (Deprecated: Use executor_work_guard.) Class to inform the io_service when -/// it has work to do. -/** - * The work class is used to inform the io_service when work starts and - * finishes. This ensures that the io_service object's run() function will not - * exit while work is underway, and that it does exit when there is no - * unfinished work remaining. - * - * The work class is copy-constructible so that it may be used as a data member - * in a handler class. It is not assignable. - */ -class io_service::work -{ -public: - /// Constructor notifies the io_service that work is starting. - /** - * The constructor is used to inform the io_service that some work has begun. - * This ensures that the io_service object's run() function will not exit - * while the work is underway. - */ - explicit work(asio::io_service& io_service); - - /// Copy constructor notifies the io_service that work is starting. - /** - * The constructor is used to inform the io_service that some work has begun. - * This ensures that the io_service object's run() function will not exit - * while the work is underway. - */ - work(const work& other); - - /// Destructor notifies the io_service that the work is complete. - /** - * The destructor is used to inform the io_service that some work has - * finished. Once the count of unfinished work reaches zero, the io_service - * object's run() function is permitted to exit. - */ - ~work(); - - /// Get the io_service associated with the work. - asio::io_service& get_io_service(); - -private: - // Prevent assignment. - void operator=(const work& other); - - // The io_service implementation. - detail::io_service_impl& io_service_impl_; -}; - -/// Base class for all io_service services. -class io_service::service - : public execution_context::service -{ -public: - /// Get the io_service object that owns the service. - asio::io_service& get_io_service(); - -protected: - /// Constructor. - /** - * @param owner The io_service object that owns the service. - */ - ASIO_DECL service(asio::io_service& owner); - - /// Destructor. - ASIO_DECL virtual ~service(); -}; - -namespace detail { - -// Special service base class to keep classes header-file only. -template -class service_base - : public asio::io_service::service -{ -public: - static asio::detail::service_id id; - - // Constructor. - service_base(asio::io_service& io_service) - : asio::io_service::service(io_service) - { - } -}; - -template -asio::detail::service_id service_base::id; - -} // namespace detail } // namespace asio #include "asio/detail/pop_options.hpp" -#include "asio/impl/io_service.hpp" -#if defined(ASIO_HEADER_ONLY) -# include "asio/impl/io_service.ipp" -#endif // defined(ASIO_HEADER_ONLY) - -// If both io_service.hpp and strand.hpp have been included, automatically -// include the header file needed for the io_service::strand class. -#if defined(ASIO_STRAND_HPP) -# include "asio/io_service_strand.hpp" -#endif // defined(ASIO_STRAND_HPP) - #endif // ASIO_IO_SERVICE_HPP diff --git a/asio/include/asio/io_service_strand.hpp b/asio/include/asio/io_service_strand.hpp index e8e1c5a5..c1ad9278 100644 --- a/asio/include/asio/io_service_strand.hpp +++ b/asio/include/asio/io_service_strand.hpp @@ -15,354 +15,6 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include "asio/detail/config.hpp" -#include "asio/async_result.hpp" -#include "asio/detail/handler_type_requirements.hpp" -#include "asio/detail/strand_service.hpp" -#include "asio/detail/wrapped_handler.hpp" -#include "asio/io_service.hpp" - -#include "asio/detail/push_options.hpp" - -namespace asio { - -/// Provides serialised handler execution. -/** - * The io_service::strand class provides the ability to post and dispatch - * handlers with the guarantee that none of those handlers will execute - * concurrently. - * - * @par Order of handler invocation - * Given: - * - * @li a strand object @c s - * - * @li an object @c a meeting completion handler requirements - * - * @li an object @c a1 which is an arbitrary copy of @c a made by the - * implementation - * - * @li an object @c b meeting completion handler requirements - * - * @li an object @c b1 which is an arbitrary copy of @c b made by the - * implementation - * - * if any of the following conditions are true: - * - * @li @c s.post(a) happens-before @c s.post(b) - * - * @li @c s.post(a) happens-before @c s.dispatch(b), where the latter is - * performed outside the strand - * - * @li @c s.dispatch(a) happens-before @c s.post(b), where the former is - * performed outside the strand - * - * @li @c s.dispatch(a) happens-before @c s.dispatch(b), where both are - * performed outside the strand - * - * then @c asio_handler_invoke(a1, &a1) happens-before - * @c asio_handler_invoke(b1, &b1). - * - * Note that in the following case: - * @code async_op_1(..., s.wrap(a)); - * async_op_2(..., s.wrap(b)); @endcode - * the completion of the first async operation will perform @c s.dispatch(a), - * and the second will perform @c s.dispatch(b), but the order in which those - * are performed is unspecified. That is, you cannot state whether one - * happens-before the other. Therefore none of the above conditions are met and - * no ordering guarantee is made. - * - * @note The implementation makes no guarantee that handlers posted or - * dispatched through different @c strand objects will be invoked concurrently. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Safe. - * - * @par Concepts: - * Dispatcher. - */ -class io_service::strand -{ -public: - /// Constructor. - /** - * Constructs the strand. - * - * @param io_service The io_service object that the strand will use to - * dispatch handlers that are ready to be run. - */ - explicit strand(asio::io_service& io_service) - : service_(asio::use_service< - asio::detail::strand_service>(io_service)) - { - service_.construct(impl_); - } - - /// Destructor. - /** - * Destroys a strand. - * - * Handlers posted through the strand that have not yet been invoked will - * still be dispatched in a way that meets the guarantee of non-concurrency. - */ - ~strand() - { - } - -#if !defined(ASIO_NO_DEPRECATED) - /// (Deprecated: Use context().) Get the io_service associated with the - /// strand. - /** - * This function may be used to obtain the io_service object that the strand - * uses to dispatch handlers for asynchronous operations. - * - * @return A reference to the io_service object that the strand will use to - * dispatch handlers. Ownership is not transferred to the caller. - */ - asio::io_service& get_io_service() - { - return service_.get_io_service(); - } -#endif // !defined(ASIO_NO_DEPRECATED) - - /// Obtain the underlying execution context. - asio::io_service& context() ASIO_NOEXCEPT - { - return service_.get_io_service(); - } - - /// Inform the strand that it has some outstanding work to do. - /** - * The strand delegates this call to its underlying io_service. - */ - void on_work_started() ASIO_NOEXCEPT - { - context().get_executor().on_work_started(); - } - - /// Inform the strand that some work is no longer outstanding. - /** - * The strand delegates this call to its underlying io_service. - */ - void on_work_finished() ASIO_NOEXCEPT - { - context().get_executor().on_work_finished(); - } - - /// Request the strand to invoke the given function object. - /** - * This function is used to ask the strand to execute the given function - * object on its underlying io_service. The function object will be executed - * inside this function if the strand is not otherwise busy and if the - * underlying io_service's executor's @c dispatch() function is also able to - * execute the function before returning. - * - * @param f The function object to be called. The executor will make - * a copy of the handler object as required. The function signature of the - * function object must be: @code void function(); @endcode - * - * @param a An allocator that may be used by the executor to allocate the - * internal storage needed for function invocation. - */ - template - void dispatch(ASIO_MOVE_ARG(Function) f, const Allocator& a) - { - typename decay::type tmp(ASIO_MOVE_CAST(Function)(f)); - service_.dispatch(impl_, tmp); - (void)a; - } - -#if !defined(ASIO_NO_DEPRECATED) - /// (Deprecated: Use asio::dispatch().) Request the strand to invoke - /// the given handler. - /** - * This function is used to ask the strand to execute the given handler. - * - * The strand object guarantees that handlers posted or dispatched through - * the strand will not be executed concurrently. The handler may be executed - * inside this function if the guarantee can be met. If this function is - * called from within a handler that was posted or dispatched through the same - * strand, then the new handler will be executed immediately. - * - * The strand's guarantee is in addition to the guarantee provided by the - * underlying io_service. The io_service guarantees that the handler will only - * be called in a thread in which the io_service's run member function is - * currently being invoked. - * - * @param handler The handler to be called. The strand will make a copy of the - * handler object as required. The function signature of the handler must be: - * @code void handler(); @endcode - */ - template - ASIO_INITFN_RESULT_TYPE(CompletionHandler, void ()) - dispatch(ASIO_MOVE_ARG(CompletionHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a CompletionHandler. - ASIO_COMPLETION_HANDLER_CHECK(CompletionHandler, handler) type_check; - - async_completion init(handler); - - service_.dispatch(impl_, init.handler); - - return init.result.get(); - } -#endif // !defined(ASIO_NO_DEPRECATED) - - /// Request the strand to invoke the given function object. - /** - * This function is used to ask the executor to execute the given function - * object. The function object will never be executed inside this function. - * Instead, it will be scheduled to run by the underlying io_service. - * - * @param f The function object to be called. The executor will make - * a copy of the handler object as required. The function signature of the - * function object must be: @code void function(); @endcode - * - * @param a An allocator that may be used by the executor to allocate the - * internal storage needed for function invocation. - */ - template - void post(ASIO_MOVE_ARG(Function) f, const Allocator& a) - { - typename decay::type tmp(ASIO_MOVE_CAST(Function)(f)); - service_.post(impl_, tmp); - (void)a; - } - -#if !defined(ASIO_NO_DEPRECATED) - /// (Deprecated: Use asio::post().) Request the strand to invoke the - /// given handler and return immediately. - /** - * This function is used to ask the strand to execute the given handler, but - * without allowing the strand to call the handler from inside this function. - * - * The strand object guarantees that handlers posted or dispatched through - * the strand will not be executed concurrently. The strand's guarantee is in - * addition to the guarantee provided by the underlying io_service. The - * io_service guarantees that the handler will only be called in a thread in - * which the io_service's run member function is currently being invoked. - * - * @param handler The handler to be called. The strand will make a copy of the - * handler object as required. The function signature of the handler must be: - * @code void handler(); @endcode - */ - template - ASIO_INITFN_RESULT_TYPE(CompletionHandler, void ()) - post(ASIO_MOVE_ARG(CompletionHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a CompletionHandler. - ASIO_COMPLETION_HANDLER_CHECK(CompletionHandler, handler) type_check; - - async_completion init(handler); - - service_.post(impl_, init.handler); - - return init.result.get(); - } -#endif // !defined(ASIO_NO_DEPRECATED) - - /// Request the strand to invoke the given function object. - /** - * This function is used to ask the executor to execute the given function - * object. The function object will never be executed inside this function. - * Instead, it will be scheduled to run by the underlying io_service. - * - * @param f The function object to be called. The executor will make - * a copy of the handler object as required. The function signature of the - * function object must be: @code void function(); @endcode - * - * @param a An allocator that may be used by the executor to allocate the - * internal storage needed for function invocation. - */ - template - void defer(ASIO_MOVE_ARG(Function) f, const Allocator& a) - { - typename decay::type tmp(ASIO_MOVE_CAST(Function)(f)); - service_.post(impl_, tmp); - (void)a; - } - -#if !defined(ASIO_NO_DEPRECATED) - /// (Deprecated: Use asio::bind_executor().) Create a new handler that - /// automatically dispatches the wrapped handler on the strand. - /** - * This function is used to create a new handler function object that, when - * invoked, will automatically pass the wrapped handler to the strand's - * dispatch function. - * - * @param handler The handler to be wrapped. The strand will make a copy of - * the handler object as required. The function signature of the handler must - * be: @code void handler(A1 a1, ... An an); @endcode - * - * @return A function object that, when invoked, passes the wrapped handler to - * the strand's dispatch function. Given a function object with the signature: - * @code R f(A1 a1, ... An an); @endcode - * If this function object is passed to the wrap function like so: - * @code strand.wrap(f); @endcode - * then the return value is a function object with the signature - * @code void g(A1 a1, ... An an); @endcode - * that, when invoked, executes code equivalent to: - * @code strand.dispatch(boost::bind(f, a1, ... an)); @endcode - */ - template -#if defined(GENERATING_DOCUMENTATION) - unspecified -#else - detail::wrapped_handler -#endif - wrap(Handler handler) - { - return detail::wrapped_handler(*this, handler); - } -#endif // !defined(ASIO_NO_DEPRECATED) - - /// Determine whether the strand is running in the current thread. - /** - * @return @c true if the current thread is executing a handler that was - * submitted to the strand using post(), dispatch() or wrap(). Otherwise - * returns @c false. - */ - bool running_in_this_thread() const ASIO_NOEXCEPT - { - return service_.running_in_this_thread(impl_); - } - - /// Compare two strands for equality. - /** - * Two strands are equal if they refer to the same ordered, non-concurrent - * state. - */ - friend bool operator==(const strand& a, const strand& b) ASIO_NOEXCEPT - { - return a.impl_ == b.impl_; - } - - /// Compare two strands for inequality. - /** - * Two strands are equal if they refer to the same ordered, non-concurrent - * state. - */ - friend bool operator!=(const strand& a, const strand& b) ASIO_NOEXCEPT - { - return a.impl_ != b.impl_; - } - -private: - asio::detail::strand_service& service_; - asio::detail::strand_service::implementation_type impl_; -}; - -#if !defined(GENERATING_DOCUMENTATION) -template <> -struct is_executor : true_type {}; -#endif // !defined(GENERATING_DOCUMENTATION) - -} // namespace asio - -#include "asio/detail/pop_options.hpp" +#include "asio/io_context_strand.hpp" #endif // ASIO_IO_SERVICE_STRAND_HPP diff --git a/asio/include/asio/ip/basic_resolver.hpp b/asio/include/asio/ip/basic_resolver.hpp index 68e97e98..75e93df6 100644 --- a/asio/include/asio/ip/basic_resolver.hpp +++ b/asio/include/asio/ip/basic_resolver.hpp @@ -69,11 +69,11 @@ public: /** * This constructor creates a basic_resolver. * - * @param io_service The io_service object that the resolver will use to + * @param io_context The io_context object that the resolver will use to * dispatch handlers for any asynchronous operations performed on the timer. */ - explicit basic_resolver(asio::io_service& io_service) - : basic_io_object(io_service) + explicit basic_resolver(asio::io_context& io_context) + : basic_io_object(io_context) { } @@ -501,7 +501,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * A successful resolve operation is guaranteed to pass a non-empty range to * the handler. @@ -548,7 +548,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * A successful resolve operation is guaranteed to pass a non-empty range to * the handler. @@ -604,7 +604,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * A successful resolve operation is guaranteed to pass a non-empty range to * the handler. @@ -666,7 +666,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * A successful resolve operation is guaranteed to pass a non-empty range to * the handler. @@ -725,7 +725,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * A successful resolve operation is guaranteed to pass a non-empty range to * the handler. @@ -820,7 +820,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * A successful resolve operation is guaranteed to pass a non-empty range to * the handler. diff --git a/asio/include/asio/ip/multicast.hpp b/asio/include/asio/ip/multicast.hpp index 4af2c3a1..3d3b8f0b 100644 --- a/asio/include/asio/ip/multicast.hpp +++ b/asio/include/asio/ip/multicast.hpp @@ -32,7 +32,7 @@ namespace multicast { * @par Examples * Setting the option to join a multicast group: * @code - * asio::ip::udp::socket socket(io_service); + * asio::ip::udp::socket socket(io_context); * ... * asio::ip::address multicast_address = * asio::ip::address::from_string("225.0.0.1"); @@ -60,7 +60,7 @@ typedef asio::ip::detail::socket_option::multicast_request< * @par Examples * Setting the option to leave a multicast group: * @code - * asio::ip::udp::socket socket(io_service); + * asio::ip::udp::socket socket(io_context); * ... * asio::ip::address multicast_address = * asio::ip::address::from_string("225.0.0.1"); @@ -88,7 +88,7 @@ typedef asio::ip::detail::socket_option::multicast_request< * @par Examples * Setting the option: * @code - * asio::ip::udp::socket socket(io_service); + * asio::ip::udp::socket socket(io_context); * ... * asio::ip::address_v4 local_interface = * asio::ip::address_v4::from_string("1.2.3.4"); @@ -116,7 +116,7 @@ typedef asio::ip::detail::socket_option::network_interface< * @par Examples * Setting the option: * @code - * asio::ip::udp::socket socket(io_service); + * asio::ip::udp::socket socket(io_context); * ... * asio::ip::multicast::hops option(4); * socket.set_option(option); @@ -125,7 +125,7 @@ typedef asio::ip::detail::socket_option::network_interface< * @par * Getting the current option value: * @code - * asio::ip::udp::socket socket(io_service); + * asio::ip::udp::socket socket(io_context); * ... * asio::ip::multicast::hops option; * socket.get_option(option); @@ -153,7 +153,7 @@ typedef asio::ip::detail::socket_option::multicast_hops< * @par Examples * Setting the option: * @code - * asio::ip::udp::socket socket(io_service); + * asio::ip::udp::socket socket(io_context); * ... * asio::ip::multicast::enable_loopback option(true); * socket.set_option(option); @@ -162,7 +162,7 @@ typedef asio::ip::detail::socket_option::multicast_hops< * @par * Getting the current option value: * @code - * asio::ip::udp::socket socket(io_service); + * asio::ip::udp::socket socket(io_context); * ... * asio::ip::multicast::enable_loopback option; * socket.get_option(option); diff --git a/asio/include/asio/ip/resolver_service.hpp b/asio/include/asio/ip/resolver_service.hpp index 3b78f103..01959580 100644 --- a/asio/include/asio/ip/resolver_service.hpp +++ b/asio/include/asio/ip/resolver_service.hpp @@ -18,7 +18,7 @@ #include "asio/detail/config.hpp" #include "asio/async_result.hpp" #include "asio/error_code.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/ip/basic_resolver_iterator.hpp" #include "asio/ip/basic_resolver_query.hpp" #include "asio/ip/basic_resolver_results.hpp" @@ -38,7 +38,7 @@ namespace ip { template class resolver_service #if defined(GENERATING_DOCUMENTATION) - : public asio::io_service::service + : public asio::io_context::service #else : public asio::detail::service_base< resolver_service > @@ -47,7 +47,7 @@ class resolver_service public: #if defined(GENERATING_DOCUMENTATION) /// The unique service identifier. - static asio::io_service::id id; + static asio::io_context::id id; #endif /// The protocol type. @@ -83,11 +83,11 @@ public: typedef typename service_impl_type::implementation_type implementation_type; #endif - /// Construct a new resolver service for the specified io_service. - explicit resolver_service(asio::io_service& io_service) + /// Construct a new resolver service for the specified io_context. + explicit resolver_service(asio::io_context& io_context) : asio::detail::service_base< - resolver_service >(io_service), - service_impl_(io_service) + resolver_service >(io_context), + service_impl_(io_context) { } @@ -161,7 +161,7 @@ private: } // Perform any fork-related housekeeping. - void fork_service(asio::io_service::fork_event event) + void fork_service(asio::io_context::fork_event event) { service_impl_.fork_service(event); } diff --git a/asio/include/asio/ip/tcp.hpp b/asio/include/asio/ip/tcp.hpp index 90009f4e..87689624 100644 --- a/asio/include/asio/ip/tcp.hpp +++ b/asio/include/asio/ip/tcp.hpp @@ -99,7 +99,7 @@ public: * @par Examples * Setting the option: * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::ip::tcp::no_delay option(true); * socket.set_option(option); @@ -108,7 +108,7 @@ public: * @par * Getting the current option value: * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::ip::tcp::no_delay option; * socket.get_option(option); diff --git a/asio/include/asio/ip/unicast.hpp b/asio/include/asio/ip/unicast.hpp index b07d10bf..2f4c0d8e 100644 --- a/asio/include/asio/ip/unicast.hpp +++ b/asio/include/asio/ip/unicast.hpp @@ -32,7 +32,7 @@ namespace unicast { * @par Examples * Setting the option: * @code - * asio::ip::udp::socket socket(io_service); + * asio::ip::udp::socket socket(io_context); * ... * asio::ip::unicast::hops option(4); * socket.set_option(option); @@ -41,7 +41,7 @@ namespace unicast { * @par * Getting the current option value: * @code - * asio::ip::udp::socket socket(io_service); + * asio::ip::udp::socket socket(io_context); * ... * asio::ip::unicast::hops option; * socket.get_option(option); diff --git a/asio/include/asio/ip/v6_only.hpp b/asio/include/asio/ip/v6_only.hpp index 9b51097c..9d89f8cc 100644 --- a/asio/include/asio/ip/v6_only.hpp +++ b/asio/include/asio/ip/v6_only.hpp @@ -31,7 +31,7 @@ namespace ip { * @par Examples * Setting the option: * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::ip::v6_only option(true); * socket.set_option(option); @@ -40,7 +40,7 @@ namespace ip { * @par * Getting the current option value: * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::ip::v6_only option; * socket.get_option(option); diff --git a/asio/include/asio/posix/basic_descriptor.hpp b/asio/include/asio/posix/basic_descriptor.hpp index 9aa18f32..c471747a 100644 --- a/asio/include/asio/posix/basic_descriptor.hpp +++ b/asio/include/asio/posix/basic_descriptor.hpp @@ -55,12 +55,12 @@ public: /** * This constructor creates a descriptor without opening it. * - * @param io_service The io_service object that the descriptor will use to + * @param io_context The io_context object that the descriptor will use to * dispatch handlers for any asynchronous operations performed on the * descriptor. */ - explicit basic_descriptor(asio::io_service& io_service) - : basic_io_object(io_service) + explicit basic_descriptor(asio::io_context& io_context) + : basic_io_object(io_context) { } @@ -69,7 +69,7 @@ public: * This constructor creates a descriptor object to hold an existing native * descriptor. * - * @param io_service The io_service object that the descriptor will use to + * @param io_context The io_context object that the descriptor will use to * dispatch handlers for any asynchronous operations performed on the * descriptor. * @@ -77,9 +77,9 @@ public: * * @throws asio::system_error Thrown on failure. */ - basic_descriptor(asio::io_service& io_service, + basic_descriptor(asio::io_context& io_context, const native_handle_type& native_descriptor) - : basic_io_object(io_service) + : basic_io_object(io_context) { asio::error_code ec; this->get_service().assign(this->get_implementation(), @@ -96,7 +96,7 @@ public: * occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_descriptor(io_service&) constructor. + * constructed using the @c basic_descriptor(io_context&) constructor. */ basic_descriptor(basic_descriptor&& other) : basic_io_object( @@ -112,7 +112,7 @@ public: * occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_descriptor(io_service&) constructor. + * constructed using the @c basic_descriptor(io_context&) constructor. */ basic_descriptor& operator=(basic_descriptor&& other) { @@ -286,7 +286,7 @@ public: * @par Example * Getting the number of bytes ready to read: * @code - * asio::posix::stream_descriptor descriptor(io_service); + * asio::posix::stream_descriptor descriptor(io_context); * ... * asio::posix::stream_descriptor::bytes_readable command; * descriptor.io_control(command); @@ -316,7 +316,7 @@ public: * @par Example * Getting the number of bytes ready to read: * @code - * asio::posix::stream_descriptor descriptor(io_service); + * asio::posix::stream_descriptor descriptor(io_context); * ... * asio::posix::stream_descriptor::bytes_readable command; * asio::error_code ec; @@ -468,7 +468,7 @@ public: * @par Example * Waiting for a descriptor to become readable. * @code - * asio::posix::stream_descriptor descriptor(io_service); + * asio::posix::stream_descriptor descriptor(io_context); * ... * descriptor.wait(asio::posix::stream_descriptor::wait_read); * @endcode @@ -493,7 +493,7 @@ public: * @par Example * Waiting for a descriptor to become readable. * @code - * asio::posix::stream_descriptor descriptor(io_service); + * asio::posix::stream_descriptor descriptor(io_context); * ... * asio::error_code ec; * descriptor.wait(asio::posix::stream_descriptor::wait_read, ec); @@ -521,7 +521,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * @code @@ -535,7 +535,7 @@ public: * * ... * - * asio::posix::stream_descriptor descriptor(io_service); + * asio::posix::stream_descriptor descriptor(io_context); * ... * descriptor.async_wait( * asio::posix::stream_descriptor::wait_read, diff --git a/asio/include/asio/posix/basic_stream_descriptor.hpp b/asio/include/asio/posix/basic_stream_descriptor.hpp index f185c30e..b81f7eeb 100644 --- a/asio/include/asio/posix/basic_stream_descriptor.hpp +++ b/asio/include/asio/posix/basic_stream_descriptor.hpp @@ -59,12 +59,12 @@ public: * descriptor needs to be opened and then connected or accepted before data * can be sent or received on it. * - * @param io_service The io_service object that the stream descriptor will + * @param io_context The io_context object that the stream descriptor will * use to dispatch handlers for any asynchronous operations performed on the * descriptor. */ - explicit basic_stream_descriptor(asio::io_service& io_service) - : basic_descriptor(io_service) + explicit basic_stream_descriptor(asio::io_context& io_context) + : basic_descriptor(io_context) { } @@ -73,7 +73,7 @@ public: * This constructor creates a stream descriptor object to hold an existing * native descriptor. * - * @param io_service The io_service object that the stream descriptor will + * @param io_context The io_context object that the stream descriptor will * use to dispatch handlers for any asynchronous operations performed on the * descriptor. * @@ -81,9 +81,9 @@ public: * * @throws asio::system_error Thrown on failure. */ - basic_stream_descriptor(asio::io_service& io_service, + basic_stream_descriptor(asio::io_context& io_context, const native_handle_type& native_descriptor) - : basic_descriptor(io_service, native_descriptor) + : basic_descriptor(io_context, native_descriptor) { } @@ -96,7 +96,7 @@ public: * will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_stream_descriptor(io_service&) constructor. + * constructed using the @c basic_stream_descriptor(io_context&) constructor. */ basic_stream_descriptor(basic_stream_descriptor&& other) : basic_descriptor( @@ -113,7 +113,7 @@ public: * will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_stream_descriptor(io_service&) constructor. + * constructed using the @c basic_stream_descriptor(io_context&) constructor. */ basic_stream_descriptor& operator=(basic_stream_descriptor&& other) { @@ -204,7 +204,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note The write operation may not transmit all of the data to the peer. * Consider using the @ref async_write function if you need to ensure that all @@ -316,7 +316,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note The read operation may not read all of the requested number of bytes. * Consider using the @ref async_read function if you need to ensure that the diff --git a/asio/include/asio/posix/descriptor_base.hpp b/asio/include/asio/posix/descriptor_base.hpp index e8d97845..0f7802f1 100644 --- a/asio/include/asio/posix/descriptor_base.hpp +++ b/asio/include/asio/posix/descriptor_base.hpp @@ -57,7 +57,7 @@ public: * * @par Example * @code - * asio::posix::stream_descriptor descriptor(io_service); + * asio::posix::stream_descriptor descriptor(io_context); * ... * asio::descriptor_base::bytes_readable command(true); * descriptor.io_control(command); diff --git a/asio/include/asio/posix/stream_descriptor_service.hpp b/asio/include/asio/posix/stream_descriptor_service.hpp index 9e216b29..0c524951 100644 --- a/asio/include/asio/posix/stream_descriptor_service.hpp +++ b/asio/include/asio/posix/stream_descriptor_service.hpp @@ -23,7 +23,7 @@ #include #include "asio/async_result.hpp" #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/detail/reactive_descriptor_service.hpp" #include "asio/detail/push_options.hpp" @@ -34,7 +34,7 @@ namespace posix { /// Default service implementation for a stream descriptor. class stream_descriptor_service #if defined(GENERATING_DOCUMENTATION) - : public asio::io_service::service + : public asio::io_context::service #else : public asio::detail::service_base #endif @@ -42,7 +42,7 @@ class stream_descriptor_service public: #if defined(GENERATING_DOCUMENTATION) /// The unique service identifier. - static asio::io_service::id id; + static asio::io_context::id id; #endif private: @@ -64,10 +64,10 @@ public: typedef service_impl_type::native_handle_type native_handle_type; #endif - /// Construct a new stream descriptor service for the specified io_service. - explicit stream_descriptor_service(asio::io_service& io_service) - : asio::detail::service_base(io_service), - service_impl_(io_service) + /// Construct a new stream descriptor service for the specified io_context. + explicit stream_descriptor_service(asio::io_context& io_context) + : asio::detail::service_base(io_context), + service_impl_(io_context) { } diff --git a/asio/include/asio/raw_socket_service.hpp b/asio/include/asio/raw_socket_service.hpp index fbf4538c..f0da7c52 100644 --- a/asio/include/asio/raw_socket_service.hpp +++ b/asio/include/asio/raw_socket_service.hpp @@ -20,7 +20,7 @@ #include "asio/async_result.hpp" #include "asio/detail/type_traits.hpp" #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #if defined(ASIO_WINDOWS_RUNTIME) # include "asio/detail/null_socket_service.hpp" @@ -38,7 +38,7 @@ namespace asio { template class raw_socket_service #if defined(GENERATING_DOCUMENTATION) - : public asio::io_service::service + : public asio::io_context::service #else : public asio::detail::service_base > #endif @@ -46,7 +46,7 @@ class raw_socket_service public: #if defined(GENERATING_DOCUMENTATION) /// The unique service identifier. - static asio::io_service::id id; + static asio::io_context::id id; #endif /// The protocol type. @@ -80,11 +80,11 @@ public: typedef typename service_impl_type::native_handle_type native_handle_type; #endif - /// Construct a new raw socket service for the specified io_service. - explicit raw_socket_service(asio::io_service& io_service) + /// Construct a new raw socket service for the specified io_context. + explicit raw_socket_service(asio::io_context& io_context) : asio::detail::service_base< - raw_socket_service >(io_service), - service_impl_(io_service) + raw_socket_service >(io_context), + service_impl_(io_context) { } diff --git a/asio/include/asio/read.hpp b/asio/include/asio/read.hpp index ff5913e7..5ee26d34 100644 --- a/asio/include/asio/read.hpp +++ b/asio/include/asio/read.hpp @@ -575,7 +575,7 @@ std::size_t read(SyncReadStream& s, basic_streambuf& b, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * To read into a single data buffer use the @ref buffer function as follows: @@ -653,7 +653,7 @@ async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * To read into a single data buffer use the @ref buffer function as follows: @@ -718,7 +718,7 @@ async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note This overload is equivalent to calling: * @code asio::async_read( @@ -793,7 +793,7 @@ async_read(AsyncReadStream& s, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). */ template @@ -849,7 +849,7 @@ async_read(AsyncReadStream& s, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note This overload is equivalent to calling: * @code asio::async_read( @@ -917,7 +917,7 @@ async_read(AsyncReadStream& s, basic_streambuf& b, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). */ template diff --git a/asio/include/asio/read_at.hpp b/asio/include/asio/read_at.hpp index 15291fcf..694c0344 100644 --- a/asio/include/asio/read_at.hpp +++ b/asio/include/asio/read_at.hpp @@ -436,7 +436,7 @@ std::size_t read_at(SyncRandomAccessReadDevice& d, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * To read into a single data buffer use the @ref buffer function as follows: @@ -514,7 +514,7 @@ async_read_at(AsyncRandomAccessReadDevice& d, uint64_t offset, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * To read into a single data buffer use the @ref buffer function as follows: @@ -574,7 +574,7 @@ async_read_at(AsyncRandomAccessReadDevice& d, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note This overload is equivalent to calling: * @code asio::async_read_at( @@ -640,7 +640,7 @@ async_read_at(AsyncRandomAccessReadDevice& d, uint64_t offset, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). */ template diff --git a/asio/include/asio/read_until.hpp b/asio/include/asio/read_until.hpp index a33e92c4..c3b07ceb 100644 --- a/asio/include/asio/read_until.hpp +++ b/asio/include/asio/read_until.hpp @@ -1034,7 +1034,7 @@ std::size_t read_until(SyncReadStream& s, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note After a successful async_read_until operation, the dynamic buffer * sequence may contain additional data beyond the delimiter. An application @@ -1124,7 +1124,7 @@ async_read_until(AsyncReadStream& s, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note After a successful async_read_until operation, the dynamic buffer * sequence may contain additional data beyond the delimiter. An application @@ -1220,7 +1220,7 @@ async_read_until(AsyncReadStream& s, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note After a successful async_read_until operation, the dynamic buffer * sequence may contain additional data beyond that which matched the regular @@ -1329,7 +1329,7 @@ async_read_until(AsyncReadStream& s, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note After a successful async_read_until operation, the dynamic buffer * sequence may contain additional data beyond that which matched the function @@ -1451,7 +1451,7 @@ async_read_until(AsyncReadStream& s, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note After a successful async_read_until operation, the streambuf may * contain additional data beyond the delimiter. An application will typically @@ -1536,7 +1536,7 @@ async_read_until(AsyncReadStream& s, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note After a successful async_read_until operation, the streambuf may * contain additional data beyond the delimiter. An application will typically @@ -1627,7 +1627,7 @@ async_read_until(AsyncReadStream& s, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note After a successful async_read_until operation, the streambuf may * contain additional data beyond that which matched the regular expression. An @@ -1729,7 +1729,7 @@ async_read_until(AsyncReadStream& s, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note After a successful async_read_until operation, the streambuf may * contain additional data beyond that which matched the function object. An diff --git a/asio/include/asio/seq_packet_socket_service.hpp b/asio/include/asio/seq_packet_socket_service.hpp index f47154fe..17cd1400 100644 --- a/asio/include/asio/seq_packet_socket_service.hpp +++ b/asio/include/asio/seq_packet_socket_service.hpp @@ -20,7 +20,7 @@ #include "asio/async_result.hpp" #include "asio/detail/type_traits.hpp" #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #if defined(ASIO_WINDOWS_RUNTIME) # include "asio/detail/null_socket_service.hpp" @@ -38,7 +38,7 @@ namespace asio { template class seq_packet_socket_service #if defined(GENERATING_DOCUMENTATION) - : public asio::io_service::service + : public asio::io_context::service #else : public asio::detail::service_base< seq_packet_socket_service > @@ -47,7 +47,7 @@ class seq_packet_socket_service public: #if defined(GENERATING_DOCUMENTATION) /// The unique service identifier. - static asio::io_service::id id; + static asio::io_context::id id; #endif /// The protocol type. @@ -82,11 +82,11 @@ public: #endif /// Construct a new sequenced packet socket service for the specified - /// io_service. - explicit seq_packet_socket_service(asio::io_service& io_service) + /// io_context. + explicit seq_packet_socket_service(asio::io_context& io_context) : asio::detail::service_base< - seq_packet_socket_service >(io_service), - service_impl_(io_service) + seq_packet_socket_service >(io_context), + service_impl_(io_context) { } diff --git a/asio/include/asio/serial_port_service.hpp b/asio/include/asio/serial_port_service.hpp index 6b930c32..907dee98 100644 --- a/asio/include/asio/serial_port_service.hpp +++ b/asio/include/asio/serial_port_service.hpp @@ -26,7 +26,7 @@ #include "asio/detail/reactive_serial_port_service.hpp" #include "asio/detail/win_iocp_serial_port_service.hpp" #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/serial_port_base.hpp" #include "asio/detail/push_options.hpp" @@ -36,7 +36,7 @@ namespace asio { /// Default service implementation for a serial port. class serial_port_service #if defined(GENERATING_DOCUMENTATION) - : public asio::io_service::service + : public asio::io_context::service #else : public asio::detail::service_base #endif @@ -44,7 +44,7 @@ class serial_port_service public: #if defined(GENERATING_DOCUMENTATION) /// The unique service identifier. - static asio::io_service::id id; + static asio::io_context::id id; #endif private: @@ -70,10 +70,10 @@ public: typedef service_impl_type::native_handle_type native_handle_type; #endif - /// Construct a new serial port service for the specified io_service. - explicit serial_port_service(asio::io_service& io_service) - : asio::detail::service_base(io_service), - service_impl_(io_service) + /// Construct a new serial port service for the specified io_context. + explicit serial_port_service(asio::io_context& io_context) + : asio::detail::service_base(io_context), + service_impl_(io_context) { } diff --git a/asio/include/asio/signal_set_service.hpp b/asio/include/asio/signal_set_service.hpp index a31f513c..4ba418a2 100644 --- a/asio/include/asio/signal_set_service.hpp +++ b/asio/include/asio/signal_set_service.hpp @@ -19,7 +19,7 @@ #include "asio/async_result.hpp" #include "asio/detail/signal_set_service.hpp" #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/detail/push_options.hpp" @@ -28,7 +28,7 @@ namespace asio { /// Default service implementation for a signal set. class signal_set_service #if defined(GENERATING_DOCUMENTATION) - : public asio::io_service::service + : public asio::io_context::service #else : public asio::detail::service_base #endif @@ -36,7 +36,7 @@ class signal_set_service public: #if defined(GENERATING_DOCUMENTATION) /// The unique service identifier. - static asio::io_service::id id; + static asio::io_context::id id; #endif public: @@ -47,10 +47,10 @@ public: typedef detail::signal_set_service::implementation_type implementation_type; #endif - /// Construct a new signal set service for the specified io_service. - explicit signal_set_service(asio::io_service& io_service) - : asio::detail::service_base(io_service), - service_impl_(io_service) + /// Construct a new signal set service for the specified io_context. + explicit signal_set_service(asio::io_context& io_context) + : asio::detail::service_base(io_context), + service_impl_(io_context) { } @@ -117,7 +117,7 @@ private: } // Perform any fork-related housekeeping. - void fork_service(asio::io_service::fork_event event) + void fork_service(asio::io_context::fork_event event) { service_impl_.fork_service(event); } diff --git a/asio/include/asio/socket_acceptor_service.hpp b/asio/include/asio/socket_acceptor_service.hpp index 04ba30c2..f2b60040 100644 --- a/asio/include/asio/socket_acceptor_service.hpp +++ b/asio/include/asio/socket_acceptor_service.hpp @@ -19,7 +19,7 @@ #include "asio/basic_socket.hpp" #include "asio/detail/type_traits.hpp" #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #if defined(ASIO_WINDOWS_RUNTIME) # include "asio/detail/null_socket_service.hpp" @@ -37,7 +37,7 @@ namespace asio { template class socket_acceptor_service #if defined(GENERATING_DOCUMENTATION) - : public asio::io_service::service + : public asio::io_context::service #else : public asio::detail::service_base > #endif @@ -45,7 +45,7 @@ class socket_acceptor_service public: #if defined(GENERATING_DOCUMENTATION) /// The unique service identifier. - static asio::io_service::id id; + static asio::io_context::id id; #endif /// The protocol type. @@ -79,11 +79,11 @@ public: typedef typename service_impl_type::native_handle_type native_handle_type; #endif - /// Construct a new socket acceptor service for the specified io_service. - explicit socket_acceptor_service(asio::io_service& io_service) + /// Construct a new socket acceptor service for the specified io_context. + explicit socket_acceptor_service(asio::io_context& io_context) : asio::detail::service_base< - socket_acceptor_service >(io_service), - service_impl_(io_service) + socket_acceptor_service >(io_context), + service_impl_(io_context) { } @@ -279,10 +279,10 @@ public: #if defined(ASIO_HAS_MOVE) /// Accept a new connection. typename Protocol::socket accept(implementation_type& impl, - io_service* peer_io_service, endpoint_type* peer_endpoint, + io_context* peer_io_context, endpoint_type* peer_endpoint, asio::error_code& ec) { - return service_impl_.accept(impl, peer_io_service, peer_endpoint, ec); + return service_impl_.accept(impl, peer_io_context, peer_endpoint, ec); } #endif // defined(ASIO_HAS_MOVE) @@ -310,7 +310,7 @@ public: ASIO_INITFN_RESULT_TYPE(MoveAcceptHandler, void (asio::error_code, typename Protocol::socket)) async_accept(implementation_type& impl, - asio::io_service* peer_io_service, endpoint_type* peer_endpoint, + asio::io_context* peer_io_context, endpoint_type* peer_endpoint, ASIO_MOVE_ARG(MoveAcceptHandler) handler) { async_completion init(handler); service_impl_.async_accept(impl, - peer_io_service, peer_endpoint, init.handler); + peer_io_context, peer_endpoint, init.handler); return init.result.get(); } diff --git a/asio/include/asio/socket_base.hpp b/asio/include/asio/socket_base.hpp index b346f3a7..5927b6aa 100644 --- a/asio/include/asio/socket_base.hpp +++ b/asio/include/asio/socket_base.hpp @@ -98,7 +98,7 @@ public: * @par Examples * Setting the option: * @code - * asio::ip::udp::socket socket(io_service); + * asio::ip::udp::socket socket(io_context); * ... * asio::socket_base::broadcast option(true); * socket.set_option(option); @@ -107,7 +107,7 @@ public: * @par * Getting the current option value: * @code - * asio::ip::udp::socket socket(io_service); + * asio::ip::udp::socket socket(io_context); * ... * asio::socket_base::broadcast option; * socket.get_option(option); @@ -132,7 +132,7 @@ public: * @par Examples * Setting the option: * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::socket_base::debug option(true); * socket.set_option(option); @@ -141,7 +141,7 @@ public: * @par * Getting the current option value: * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::socket_base::debug option; * socket.get_option(option); @@ -165,7 +165,7 @@ public: * @par Examples * Setting the option: * @code - * asio::ip::udp::socket socket(io_service); + * asio::ip::udp::socket socket(io_context); * ... * asio::socket_base::do_not_route option(true); * socket.set_option(option); @@ -174,7 +174,7 @@ public: * @par * Getting the current option value: * @code - * asio::ip::udp::socket socket(io_service); + * asio::ip::udp::socket socket(io_context); * ... * asio::socket_base::do_not_route option; * socket.get_option(option); @@ -199,7 +199,7 @@ public: * @par Examples * Setting the option: * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::socket_base::keep_alive option(true); * socket.set_option(option); @@ -208,7 +208,7 @@ public: * @par * Getting the current option value: * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::socket_base::keep_alive option; * socket.get_option(option); @@ -232,7 +232,7 @@ public: * @par Examples * Setting the option: * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::socket_base::send_buffer_size option(8192); * socket.set_option(option); @@ -241,7 +241,7 @@ public: * @par * Getting the current option value: * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::socket_base::send_buffer_size option; * socket.get_option(option); @@ -266,7 +266,7 @@ public: * @par Examples * Setting the option: * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::socket_base::send_low_watermark option(1024); * socket.set_option(option); @@ -275,7 +275,7 @@ public: * @par * Getting the current option value: * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::socket_base::send_low_watermark option; * socket.get_option(option); @@ -300,7 +300,7 @@ public: * @par Examples * Setting the option: * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::socket_base::receive_buffer_size option(8192); * socket.set_option(option); @@ -309,7 +309,7 @@ public: * @par * Getting the current option value: * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::socket_base::receive_buffer_size option; * socket.get_option(option); @@ -334,7 +334,7 @@ public: * @par Examples * Setting the option: * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::socket_base::receive_low_watermark option(1024); * socket.set_option(option); @@ -343,7 +343,7 @@ public: * @par * Getting the current option value: * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::socket_base::receive_low_watermark option; * socket.get_option(option); @@ -369,7 +369,7 @@ public: * @par Examples * Setting the option: * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * asio::socket_base::reuse_address option(true); * acceptor.set_option(option); @@ -378,7 +378,7 @@ public: * @par * Getting the current option value: * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * asio::socket_base::reuse_address option; * acceptor.get_option(option); @@ -404,7 +404,7 @@ public: * @par Examples * Setting the option: * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::socket_base::linger option(true, 30); * socket.set_option(option); @@ -413,7 +413,7 @@ public: * @par * Getting the current option value: * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::socket_base::linger option; * socket.get_option(option); @@ -441,7 +441,7 @@ public: * @par Examples * Setting the option: * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * asio::socket_base::enable_connection_aborted option(true); * acceptor.set_option(option); @@ -450,7 +450,7 @@ public: * @par * Getting the current option value: * @code - * asio::ip::tcp::acceptor acceptor(io_service); + * asio::ip::tcp::acceptor acceptor(io_context); * ... * asio::socket_base::enable_connection_aborted option; * acceptor.get_option(option); @@ -476,7 +476,7 @@ public: * * @par Example * @code - * asio::ip::tcp::socket socket(io_service); + * asio::ip::tcp::socket socket(io_context); * ... * asio::socket_base::bytes_readable command(true); * socket.io_control(command); diff --git a/asio/include/asio/spawn.hpp b/asio/include/asio/spawn.hpp index 607e7034..9fa6e7b2 100644 --- a/asio/include/asio/spawn.hpp +++ b/asio/include/asio/spawn.hpp @@ -22,7 +22,7 @@ #include "asio/detail/type_traits.hpp" #include "asio/detail/wrapped_handler.hpp" #include "asio/executor.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/is_executor.hpp" #include "asio/strand.hpp" @@ -299,7 +299,7 @@ void spawn(const strand& ex, * @param attributes Boost.Coroutine attributes used to customise the coroutine. */ template -void spawn(const asio::io_service::strand& s, +void spawn(const asio::io_context::strand& s, ASIO_MOVE_ARG(Function) function, const boost::coroutines::attributes& attributes = boost::coroutines::attributes()); diff --git a/asio/include/asio/ssl/context.hpp b/asio/include/asio/ssl/context.hpp index 2bf2e0aa..e6dc651d 100644 --- a/asio/include/asio/ssl/context.hpp +++ b/asio/include/asio/ssl/context.hpp @@ -19,7 +19,7 @@ #include #include "asio/buffer.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/ssl/context_base.hpp" #include "asio/ssl/detail/openssl_types.hpp" #include "asio/ssl/detail/openssl_init.hpp" diff --git a/asio/include/asio/ssl/detail/io.hpp b/asio/include/asio/ssl/detail/io.hpp index b2fdc76f..86781a4d 100644 --- a/asio/include/asio/ssl/detail/io.hpp +++ b/asio/include/asio/ssl/detail/io.hpp @@ -201,7 +201,7 @@ public: // have to keep in mind that this function might be being called from // the async operation's initiating function. In this case we're not // allowed to call the handler directly. Instead, issue a zero-sized - // read so the handler runs "as-if" posted using io_service::post(). + // read so the handler runs "as-if" posted using io_context::post(). if (start) { next_layer_.async_read_some( diff --git a/asio/include/asio/ssl/detail/stream_core.hpp b/asio/include/asio/ssl/detail/stream_core.hpp index 22442b12..1874bdab 100644 --- a/asio/include/asio/ssl/detail/stream_core.hpp +++ b/asio/include/asio/ssl/detail/stream_core.hpp @@ -37,10 +37,10 @@ struct stream_core // sufficient to hold the largest possible TLS record. enum { max_tls_record_size = 17 * 1024 }; - stream_core(SSL_CTX* context, asio::io_service& io_service) + stream_core(SSL_CTX* context, asio::io_context& io_context) : engine_(context), - pending_read_(io_service), - pending_write_(io_service), + pending_read_(io_context), + pending_write_(io_context), output_buffer_space_(max_tls_record_size), output_buffer_(asio::buffer(output_buffer_space_)), input_buffer_space_(max_tls_record_size), diff --git a/asio/include/asio/ssl/rfc2818_verification.hpp b/asio/include/asio/ssl/rfc2818_verification.hpp index 7529855d..00a29f1e 100644 --- a/asio/include/asio/ssl/rfc2818_verification.hpp +++ b/asio/include/asio/ssl/rfc2818_verification.hpp @@ -42,9 +42,9 @@ namespace ssl { * ctx.set_default_verify_paths(); * * // Open a socket and connect it to the remote host. - * asio::io_service io_service; - * ssl_socket sock(io_service, ctx); - * tcp::resolver resolver(io_service); + * asio::io_context io_context; + * ssl_socket sock(io_context, ctx); + * tcp::resolver resolver(io_context); * tcp::resolver::query query("host.name", "https"); * asio::connect(sock.lowest_layer(), resolver.resolve(query)); * sock.lowest_layer().set_option(tcp::no_delay(true)); diff --git a/asio/include/asio/ssl/stream.hpp b/asio/include/asio/ssl/stream.hpp index f80a67cf..207bba3d 100644 --- a/asio/include/asio/ssl/stream.hpp +++ b/asio/include/asio/ssl/stream.hpp @@ -51,9 +51,9 @@ namespace ssl { * @par Example * To use the SSL stream template with an ip::tcp::socket, you would write: * @code - * asio::io_service io_service; + * asio::io_context io_context; * asio::ssl::context ctx(asio::ssl::context::sslv23); - * asio::ssl::stream sock(io_service, ctx); + * asio::ssl::stream sock(io_context, ctx); * @endcode * * @par Concepts: @@ -112,17 +112,17 @@ public: { } - /// Get the io_service associated with the object. + /// Get the io_context associated with the object. /** - * This function may be used to obtain the io_service object that the stream + * This function may be used to obtain the io_context object that the stream * uses to dispatch handlers for asynchronous operations. * - * @return A reference to the io_service object that stream will use to + * @return A reference to the io_context object that stream will use to * dispatch handlers. Ownership is not transferred to the caller. */ - asio::io_service& get_io_service() + asio::io_context& get_io_context() { - return next_layer_.lowest_layer().get_io_service(); + return next_layer_.lowest_layer().get_io_context(); } /// Get the underlying implementation in the native type. @@ -136,7 +136,7 @@ public: * suitable for passing to functions such as @c SSL_get_verify_result and * @c SSL_get_peer_certificate: * @code - * asio::ssl::stream sock(io_service, ctx); + * asio::ssl::stream sock(io_context, ctx); * * // ... establish connection and perform handshake ... * diff --git a/asio/include/asio/strand.hpp b/asio/include/asio/strand.hpp index 389e0047..488b540c 100644 --- a/asio/include/asio/strand.hpp +++ b/asio/include/asio/strand.hpp @@ -281,10 +281,10 @@ struct is_executor > : true_type {}; #include "asio/detail/pop_options.hpp" -// If both io_service.hpp and strand.hpp have been included, automatically -// include the header file needed for the io_service::strand class. -#if defined(ASIO_IO_SERVICE_HPP) -# include "asio/io_service_strand.hpp" -#endif // defined(ASIO_IO_SERVICE_HPP) +// If both io_context.hpp and strand.hpp have been included, automatically +// include the header file needed for the io_context::strand class. +#if defined(ASIO_IO_CONTEXT_HPP) +# include "asio/io_context_strand.hpp" +#endif // defined(ASIO_IO_CONTEXT_HPP) #endif // ASIO_STRAND_HPP diff --git a/asio/include/asio/stream_socket_service.hpp b/asio/include/asio/stream_socket_service.hpp index bec5b839..517bc1f5 100644 --- a/asio/include/asio/stream_socket_service.hpp +++ b/asio/include/asio/stream_socket_service.hpp @@ -20,7 +20,7 @@ #include "asio/async_result.hpp" #include "asio/detail/type_traits.hpp" #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #if defined(ASIO_WINDOWS_RUNTIME) # include "asio/detail/winrt_ssocket_service.hpp" @@ -38,7 +38,7 @@ namespace asio { template class stream_socket_service #if defined(GENERATING_DOCUMENTATION) - : public asio::io_service::service + : public asio::io_context::service #else : public asio::detail::service_base > #endif @@ -46,7 +46,7 @@ class stream_socket_service public: #if defined(GENERATING_DOCUMENTATION) /// The unique service identifier. - static asio::io_service::id id; + static asio::io_context::id id; #endif /// The protocol type. @@ -80,11 +80,11 @@ public: typedef typename service_impl_type::native_handle_type native_handle_type; #endif - /// Construct a new stream socket service for the specified io_service. - explicit stream_socket_service(asio::io_service& io_service) + /// Construct a new stream socket service for the specified io_context. + explicit stream_socket_service(asio::io_context& io_context) : asio::detail::service_base< - stream_socket_service >(io_service), - service_impl_(io_service) + stream_socket_service >(io_context), + service_impl_(io_context) { } diff --git a/asio/include/asio/thread.hpp b/asio/include/asio/thread.hpp index 64681309..f101ed50 100644 --- a/asio/include/asio/thread.hpp +++ b/asio/include/asio/thread.hpp @@ -36,12 +36,12 @@ namespace asio { * * @par Example * A typical use of asio::thread would be to launch a thread to run an - * io_service's event processing loop: + * io_context's event processing loop: * * @par - * @code asio::io_service io_service; + * @code asio::io_context io_context; * // ... - * asio::thread t(boost::bind(&asio::io_service::run, &io_service)); + * asio::thread t(boost::bind(&asio::io_context::run, &io_context)); * // ... * t.join(); @endcode */ diff --git a/asio/include/asio/ts/io_service.hpp b/asio/include/asio/ts/io_context.hpp similarity index 71% rename from asio/include/asio/ts/io_service.hpp rename to asio/include/asio/ts/io_context.hpp index 5c0a44ea..a648624c 100644 --- a/asio/include/asio/ts/io_service.hpp +++ b/asio/include/asio/ts/io_context.hpp @@ -1,5 +1,5 @@ // -// ts/io_service.hpp +// ts/io_context.hpp // ~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) @@ -8,13 +8,13 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef ASIO_TS_IO_SERVICE_HPP -#define ASIO_TS_IO_SERVICE_HPP +#ifndef ASIO_TS_IO_CONTEXT_HPP +#define ASIO_TS_IO_CONTEXT_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" -#endif // ASIO_TS_IO_SERVICE_HPP +#endif // ASIO_TS_IO_CONTEXT_HPP diff --git a/asio/include/asio/ts/networking.hpp b/asio/include/asio/ts/networking.hpp index a9cd88dc..75ac6e81 100644 --- a/asio/include/asio/ts/networking.hpp +++ b/asio/include/asio/ts/networking.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/ts/executor.hpp" -#include "asio/ts/io_service.hpp" +#include "asio/ts/io_context.hpp" #include "asio/ts/timer.hpp" #include "asio/ts/buffer.hpp" #include "asio/ts/socket.hpp" diff --git a/asio/include/asio/waitable_timer_service.hpp b/asio/include/asio/waitable_timer_service.hpp index 828bbfe6..ac34aa52 100644 --- a/asio/include/asio/waitable_timer_service.hpp +++ b/asio/include/asio/waitable_timer_service.hpp @@ -20,7 +20,7 @@ #include "asio/async_result.hpp" #include "asio/detail/chrono_time_traits.hpp" #include "asio/detail/deadline_timer_service.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/wait_traits.hpp" #include "asio/detail/push_options.hpp" @@ -32,7 +32,7 @@ template > class waitable_timer_service #if defined(GENERATING_DOCUMENTATION) - : public asio::io_service::service + : public asio::io_context::service #else : public asio::detail::service_base< waitable_timer_service > @@ -41,7 +41,7 @@ class waitable_timer_service public: #if defined(GENERATING_DOCUMENTATION) /// The unique service identifier. - static asio::io_service::id id; + static asio::io_context::id id; #endif /// The clock type. @@ -69,11 +69,11 @@ public: typedef typename service_impl_type::implementation_type implementation_type; #endif - /// Construct a new timer service for the specified io_service. - explicit waitable_timer_service(asio::io_service& io_service) + /// Construct a new timer service for the specified io_context. + explicit waitable_timer_service(asio::io_context& io_context) : asio::detail::service_base< - waitable_timer_service >(io_service), - service_impl_(io_service) + waitable_timer_service >(io_context), + service_impl_(io_context) { } diff --git a/asio/include/asio/windows/basic_handle.hpp b/asio/include/asio/windows/basic_handle.hpp index 2398e755..6ef82251 100644 --- a/asio/include/asio/windows/basic_handle.hpp +++ b/asio/include/asio/windows/basic_handle.hpp @@ -55,11 +55,11 @@ public: /** * This constructor creates a handle without opening it. * - * @param io_service The io_service object that the handle will use to + * @param io_context The io_context object that the handle will use to * dispatch handlers for any asynchronous operations performed on the handle. */ - explicit basic_handle(asio::io_service& io_service) - : basic_io_object(io_service) + explicit basic_handle(asio::io_context& io_context) + : basic_io_object(io_context) { } @@ -67,16 +67,16 @@ public: /** * This constructor creates a handle object to hold an existing native handle. * - * @param io_service The io_service object that the handle will use to + * @param io_context The io_context object that the handle will use to * dispatch handlers for any asynchronous operations performed on the handle. * * @param handle A native handle. * * @throws asio::system_error Thrown on failure. */ - basic_handle(asio::io_service& io_service, + basic_handle(asio::io_context& io_context, const native_handle_type& handle) - : basic_io_object(io_service) + : basic_io_object(io_context) { asio::error_code ec; this->get_service().assign(this->get_implementation(), handle, ec); @@ -91,7 +91,7 @@ public: * @param other The other basic_handle object from which the move will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_handle(io_service&) constructor. + * constructed using the @c basic_handle(io_context&) constructor. */ basic_handle(basic_handle&& other) : basic_io_object( @@ -106,7 +106,7 @@ public: * @param other The other basic_handle object from which the move will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_handle(io_service&) constructor. + * constructed using the @c basic_handle(io_context&) constructor. */ basic_handle& operator=(basic_handle&& other) { diff --git a/asio/include/asio/windows/basic_object_handle.hpp b/asio/include/asio/windows/basic_object_handle.hpp index 314badce..8bfce46e 100644 --- a/asio/include/asio/windows/basic_object_handle.hpp +++ b/asio/include/asio/windows/basic_object_handle.hpp @@ -52,11 +52,11 @@ public: /** * This constructor creates an object handle without opening it. * - * @param io_service The io_service object that the object handle will use to + * @param io_context The io_context object that the object handle will use to * dispatch handlers for any asynchronous operations performed on the handle. */ - explicit basic_object_handle(asio::io_service& io_service) - : basic_handle(io_service) + explicit basic_object_handle(asio::io_context& io_context) + : basic_handle(io_context) { } @@ -65,16 +65,16 @@ public: * This constructor creates an object handle object to hold an existing native * handle. * - * @param io_service The io_service object that the object handle will use to + * @param io_context The io_context object that the object handle will use to * dispatch handlers for any asynchronous operations performed on the handle. * * @param native_handle The new underlying handle implementation. * * @throws asio::system_error Thrown on failure. */ - basic_object_handle(asio::io_service& io_service, + basic_object_handle(asio::io_context& io_context, const native_handle_type& native_handle) - : basic_handle(io_service, native_handle) + : basic_handle(io_context, native_handle) { } @@ -87,7 +87,7 @@ public: * occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_object_handle(io_service&) constructor. + * constructed using the @c basic_object_handle(io_context&) constructor. */ basic_object_handle(basic_object_handle&& other) : basic_handle( @@ -103,7 +103,7 @@ public: * occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_object_handle(io_service&) constructor. + * constructed using the @c basic_object_handle(io_context&) constructor. */ basic_object_handle& operator=(basic_object_handle&& other) { @@ -155,7 +155,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). */ template ASIO_INITFN_RESULT_TYPE(WaitHandler, diff --git a/asio/include/asio/windows/basic_random_access_handle.hpp b/asio/include/asio/windows/basic_random_access_handle.hpp index 0da5ec22..9a66a132 100644 --- a/asio/include/asio/windows/basic_random_access_handle.hpp +++ b/asio/include/asio/windows/basic_random_access_handle.hpp @@ -55,12 +55,12 @@ public: * This constructor creates a random-access handle without opening it. The * handle needs to be opened before data can be written to or read from it. * - * @param io_service The io_service object that the random-access handle will + * @param io_context The io_context object that the random-access handle will * use to dispatch handlers for any asynchronous operations performed on the * handle. */ - explicit basic_random_access_handle(asio::io_service& io_service) - : basic_handle(io_service) + explicit basic_random_access_handle(asio::io_context& io_context) + : basic_handle(io_context) { } @@ -69,7 +69,7 @@ public: * This constructor creates a random-access handle object to hold an existing * native handle. * - * @param io_service The io_service object that the random-access handle will + * @param io_context The io_context object that the random-access handle will * use to dispatch handlers for any asynchronous operations performed on the * handle. * @@ -77,9 +77,9 @@ public: * * @throws asio::system_error Thrown on failure. */ - basic_random_access_handle(asio::io_service& io_service, + basic_random_access_handle(asio::io_context& io_context, const native_handle_type& handle) - : basic_handle(io_service, handle) + : basic_handle(io_context, handle) { } @@ -92,7 +92,7 @@ public: * move will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_random_access_handle(io_service&) + * constructed using the @c basic_random_access_handle(io_context&) * constructor. */ basic_random_access_handle(basic_random_access_handle&& other) @@ -110,7 +110,7 @@ public: * move will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_random_access_handle(io_service&) + * constructed using the @c basic_random_access_handle(io_context&) * constructor. */ basic_random_access_handle& operator=(basic_random_access_handle&& other) @@ -209,7 +209,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note The write operation may not transmit all of the data to the peer. * Consider using the @ref async_write_at function if you need to ensure that @@ -329,7 +329,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note The read operation may not read all of the requested number of bytes. * Consider using the @ref async_read_at function if you need to ensure that diff --git a/asio/include/asio/windows/basic_stream_handle.hpp b/asio/include/asio/windows/basic_stream_handle.hpp index 7927b55a..ec2ff0d8 100644 --- a/asio/include/asio/windows/basic_stream_handle.hpp +++ b/asio/include/asio/windows/basic_stream_handle.hpp @@ -58,11 +58,11 @@ public: * needs to be opened and then connected or accepted before data can be sent * or received on it. * - * @param io_service The io_service object that the stream handle will use to + * @param io_context The io_context object that the stream handle will use to * dispatch handlers for any asynchronous operations performed on the handle. */ - explicit basic_stream_handle(asio::io_service& io_service) - : basic_handle(io_service) + explicit basic_stream_handle(asio::io_context& io_context) + : basic_handle(io_context) { } @@ -71,16 +71,16 @@ public: * This constructor creates a stream handle object to hold an existing native * handle. * - * @param io_service The io_service object that the stream handle will use to + * @param io_context The io_context object that the stream handle will use to * dispatch handlers for any asynchronous operations performed on the handle. * * @param handle The new underlying handle implementation. * * @throws asio::system_error Thrown on failure. */ - basic_stream_handle(asio::io_service& io_service, + basic_stream_handle(asio::io_context& io_context, const native_handle_type& handle) - : basic_handle(io_service, handle) + : basic_handle(io_context, handle) { } @@ -93,7 +93,7 @@ public: * will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_stream_handle(io_service&) constructor. + * constructed using the @c basic_stream_handle(io_context&) constructor. */ basic_stream_handle(basic_stream_handle&& other) : basic_handle( @@ -110,7 +110,7 @@ public: * will occur. * * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_stream_handle(io_service&) constructor. + * constructed using the @c basic_stream_handle(io_context&) constructor. */ basic_stream_handle& operator=(basic_stream_handle&& other) { @@ -201,7 +201,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note The write operation may not transmit all of the data to the peer. * Consider using the @ref async_write function if you need to ensure that all @@ -313,7 +313,7 @@ public: * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @note The read operation may not read all of the requested number of bytes. * Consider using the @ref async_read function if you need to ensure that the diff --git a/asio/include/asio/windows/object_handle_service.hpp b/asio/include/asio/windows/object_handle_service.hpp index 84384da6..2bd27938 100644 --- a/asio/include/asio/windows/object_handle_service.hpp +++ b/asio/include/asio/windows/object_handle_service.hpp @@ -24,7 +24,7 @@ #include "asio/async_result.hpp" #include "asio/detail/win_object_handle_service.hpp" #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/detail/push_options.hpp" @@ -34,7 +34,7 @@ namespace windows { /// Default service implementation for an object handle. class object_handle_service #if defined(GENERATING_DOCUMENTATION) - : public asio::io_service::service + : public asio::io_context::service #else : public asio::detail::service_base #endif @@ -42,7 +42,7 @@ class object_handle_service public: #if defined(GENERATING_DOCUMENTATION) /// The unique service identifier. - static asio::io_service::id id; + static asio::io_context::id id; #endif private: @@ -64,10 +64,10 @@ public: typedef service_impl_type::native_handle_type native_handle_type; #endif - /// Construct a new object handle service for the specified io_service. - explicit object_handle_service(asio::io_service& io_service) - : asio::detail::service_base(io_service), - service_impl_(io_service) + /// Construct a new object handle service for the specified io_context. + explicit object_handle_service(asio::io_context& io_context) + : asio::detail::service_base(io_context), + service_impl_(io_context) { } diff --git a/asio/include/asio/windows/overlapped_ptr.hpp b/asio/include/asio/windows/overlapped_ptr.hpp index 284b740b..81a65058 100644 --- a/asio/include/asio/windows/overlapped_ptr.hpp +++ b/asio/include/asio/windows/overlapped_ptr.hpp @@ -22,7 +22,7 @@ #include "asio/detail/noncopyable.hpp" #include "asio/detail/win_iocp_overlapped_ptr.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/detail/push_options.hpp" @@ -50,9 +50,9 @@ public: /// Construct an overlapped_ptr to contain the specified handler. template - explicit overlapped_ptr(asio::io_service& io_service, + explicit overlapped_ptr(asio::io_context& io_context, ASIO_MOVE_ARG(Handler) handler) - : impl_(io_service, ASIO_MOVE_CAST(Handler)(handler)) + : impl_(io_context, ASIO_MOVE_CAST(Handler)(handler)) { } @@ -70,10 +70,10 @@ public: /// Reset to contain the specified handler, freeing any current OVERLAPPED /// object. template - void reset(asio::io_service& io_service, + void reset(asio::io_context& io_context, ASIO_MOVE_ARG(Handler) handler) { - impl_.reset(io_service, ASIO_MOVE_CAST(Handler)(handler)); + impl_.reset(io_context, ASIO_MOVE_CAST(Handler)(handler)); } /// Get the contained OVERLAPPED object. diff --git a/asio/include/asio/windows/random_access_handle_service.hpp b/asio/include/asio/windows/random_access_handle_service.hpp index beff1dd8..c2976ab1 100644 --- a/asio/include/asio/windows/random_access_handle_service.hpp +++ b/asio/include/asio/windows/random_access_handle_service.hpp @@ -25,7 +25,7 @@ #include "asio/detail/cstdint.hpp" #include "asio/detail/win_iocp_handle_service.hpp" #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/detail/push_options.hpp" @@ -35,7 +35,7 @@ namespace windows { /// Default service implementation for a random-access handle. class random_access_handle_service #if defined(GENERATING_DOCUMENTATION) - : public asio::io_service::service + : public asio::io_context::service #else : public asio::detail::service_base #endif @@ -43,7 +43,7 @@ class random_access_handle_service public: #if defined(GENERATING_DOCUMENTATION) /// The unique service identifier. - static asio::io_service::id id; + static asio::io_context::id id; #endif private: @@ -65,11 +65,11 @@ public: typedef service_impl_type::native_handle_type native_handle_type; #endif - /// Construct a new random-access handle service for the specified io_service. - explicit random_access_handle_service(asio::io_service& io_service) + /// Construct a new random-access handle service for the specified io_context. + explicit random_access_handle_service(asio::io_context& io_context) : asio::detail::service_base< - random_access_handle_service>(io_service), - service_impl_(io_service) + random_access_handle_service>(io_context), + service_impl_(io_context) { } diff --git a/asio/include/asio/windows/stream_handle_service.hpp b/asio/include/asio/windows/stream_handle_service.hpp index 560f7108..b4980772 100644 --- a/asio/include/asio/windows/stream_handle_service.hpp +++ b/asio/include/asio/windows/stream_handle_service.hpp @@ -24,7 +24,7 @@ #include "asio/async_result.hpp" #include "asio/detail/win_iocp_handle_service.hpp" #include "asio/error.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/detail/push_options.hpp" @@ -34,7 +34,7 @@ namespace windows { /// Default service implementation for a stream handle. class stream_handle_service #if defined(GENERATING_DOCUMENTATION) - : public asio::io_service::service + : public asio::io_context::service #else : public asio::detail::service_base #endif @@ -42,7 +42,7 @@ class stream_handle_service public: #if defined(GENERATING_DOCUMENTATION) /// The unique service identifier. - static asio::io_service::id id; + static asio::io_context::id id; #endif private: @@ -64,10 +64,10 @@ public: typedef service_impl_type::native_handle_type native_handle_type; #endif - /// Construct a new stream handle service for the specified io_service. - explicit stream_handle_service(asio::io_service& io_service) - : asio::detail::service_base(io_service), - service_impl_(io_service) + /// Construct a new stream handle service for the specified io_context. + explicit stream_handle_service(asio::io_context& io_context) + : asio::detail::service_base(io_context), + service_impl_(io_context) { } diff --git a/asio/include/asio/write.hpp b/asio/include/asio/write.hpp index de309bf2..b3fb35a2 100644 --- a/asio/include/asio/write.hpp +++ b/asio/include/asio/write.hpp @@ -573,7 +573,7 @@ std::size_t write(SyncWriteStream& s, basic_streambuf& b, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * To write a single data buffer use the @ref buffer function as follows: @@ -649,7 +649,7 @@ async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * To write a single data buffer use the @ref buffer function as follows: @@ -713,7 +713,7 @@ async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). */ template @@ -781,7 +781,7 @@ async_write(AsyncWriteStream& s, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). */ template @@ -836,7 +836,7 @@ async_write(AsyncWriteStream& s, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). */ template ASIO_INITFN_RESULT_TYPE(WriteHandler, @@ -897,7 +897,7 @@ async_write(AsyncWriteStream& s, basic_streambuf& b, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). */ template diff --git a/asio/include/asio/write_at.hpp b/asio/include/asio/write_at.hpp index 45edd08d..8414ac36 100644 --- a/asio/include/asio/write_at.hpp +++ b/asio/include/asio/write_at.hpp @@ -437,7 +437,7 @@ std::size_t write_at(SyncRandomAccessWriteDevice& d, uint64_t offset, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * To write a single data buffer use the @ref buffer function as follows: @@ -515,7 +515,7 @@ async_write_at(AsyncRandomAccessWriteDevice& d, uint64_t offset, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). * * @par Example * To write a single data buffer use the @ref buffer function as follows: @@ -581,7 +581,7 @@ async_write_at(AsyncRandomAccessWriteDevice& d, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). */ template @@ -647,7 +647,7 @@ async_write_at(AsyncRandomAccessWriteDevice& d, uint64_t offset, * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using - * asio::io_service::post(). + * asio::io_context::post(). */ template diff --git a/asio/src/Makefile.mgw b/asio/src/Makefile.mgw index 2d5a5e46..ffbb1f27 100644 --- a/asio/src/Makefile.mgw +++ b/asio/src/Makefile.mgw @@ -40,7 +40,7 @@ UNIT_TEST_EXES = \ tests/unit/generic/seq_packet_protocol.exe \ tests/unit/generic/stream_protocol.exe \ tests/unit/high_resolution_timer.exe \ - tests/unit/io_service.exe \ + tests/unit/io_context.exe \ tests/unit/ip/address.exe \ tests/unit/ip/address_v4.exe \ tests/unit/ip/address_v6.exe \ @@ -185,7 +185,7 @@ examples/cpp03/http/server/http_server.exe: \ examples/cpp03/http/server2/http_server.exe: \ examples/cpp03/http/server2/connection.o \ - examples/cpp03/http/server2/io_service_pool.o \ + examples/cpp03/http/server2/io_context_pool.o \ examples/cpp03/http/server2/main.o \ examples/cpp03/http/server2/mime_types.o \ examples/cpp03/http/server2/reply.o \ diff --git a/asio/src/Makefile.msc b/asio/src/Makefile.msc index 061f711b..3e15fe42 100644 --- a/asio/src/Makefile.msc +++ b/asio/src/Makefile.msc @@ -123,7 +123,7 @@ UNIT_TEST_EXES = \ tests\unit\generic\seq_packet_protocol.exe \ tests\unit\generic\stream_protocol.exe \ tests\unit\high_resolution_timer.exe \ - tests\unit\io_service.exe \ + tests\unit\io_context.exe \ tests\unit\ip\address.exe \ tests\unit\ip\address_v4.exe \ tests\unit\ip\address_v6.exe \ @@ -390,7 +390,7 @@ examples\cpp03\http\server\http_server.exe: \ examples\cpp03\http\server2\http_server.exe: \ examples\cpp03\http\server2\connection.cpp \ - examples\cpp03\http\server2\io_service_pool.cpp \ + examples\cpp03\http\server2\io_context_pool.cpp \ examples\cpp03\http\server2\main.cpp \ examples\cpp03\http\server2\mime_types.cpp \ examples\cpp03\http\server2\reply.cpp \ diff --git a/asio/src/doc/examples.qbk b/asio/src/doc/examples.qbk index 6fd313dc..8cbf93af 100644 --- a/asio/src/doc/examples.qbk +++ b/asio/src/doc/examples.qbk @@ -120,13 +120,13 @@ cancelling all outstanding asynchronous operations. [heading HTTP Server 2] -An HTTP server using an io_service-per-CPU design. +An HTTP server using an io_context-per-CPU design. * [@../src/examples/cpp03/http/server2/connection.cpp] * [@../src/examples/cpp03/http/server2/connection.hpp] * [@../src/examples/cpp03/http/server2/header.hpp] -* [@../src/examples/cpp03/http/server2/io_service_pool.cpp] -* [@../src/examples/cpp03/http/server2/io_service_pool.hpp] +* [@../src/examples/cpp03/http/server2/io_context_pool.cpp] +* [@../src/examples/cpp03/http/server2/io_context_pool.hpp] * [@../src/examples/cpp03/http/server2/main.cpp] * [@../src/examples/cpp03/http/server2/mime_types.cpp] * [@../src/examples/cpp03/http/server2/mime_types.hpp] @@ -143,7 +143,7 @@ An HTTP server using an io_service-per-CPU design. [heading HTTP Server 3] -An HTTP server using a single io_service and a thread pool calling `io_service::run()`. +An HTTP server using a single io_context and a thread pool calling `io_context::run()`. * [@../src/examples/cpp03/http/server3/connection.cpp] * [@../src/examples/cpp03/http/server3/connection.hpp] @@ -231,7 +231,7 @@ decode structures for transmission over a socket. [heading Services] This example demonstrates how to integrate custom functionality (in this case, -for logging) into asio's [link asio.reference.io_service io_service], and +for logging) into asio's [link asio.reference.io_context io_context], and how to use a custom service with [link asio.reference.basic_stream_socket basic_stream_socket<>]. diff --git a/asio/src/doc/overview/async.qbk b/asio/src/doc/overview/async.qbk index a9ad12d3..ef566dcc 100644 --- a/asio/src/doc/overview/async.qbk +++ b/asio/src/doc/overview/async.qbk @@ -52,7 +52,7 @@ a completed event to its caller.] [:Calls the asynchronous event demultiplexer to dequeue events, and dispatches the completion handler (i.e. invokes the function object) associated with the -event. This abstraction is represented by the `io_service` class.] +event. This abstraction is represented by the `io_context` class.] [mdash] Initiator @@ -97,7 +97,7 @@ calling an overlapped function such as `AcceptEx`.] [mdash] Completion Event Queue [:This is implemented by the operating system, and is associated with an I/O -completion port. There is one I/O completion port for each `io_service` +completion port. There is one I/O completion port for each `io_context` instance.] [mdash] Asynchronous Event Demultiplexer diff --git a/asio/src/doc/overview/async_op1.dot b/asio/src/doc/overview/async_op1.dot index 9abfc0a9..cbb95fb6 100644 --- a/asio/src/doc/overview/async_op1.dot +++ b/asio/src/doc/overview/async_op1.dot @@ -28,7 +28,7 @@ digraph g // Program elements. { operating_system [ label="Operating System", shape=ellipse ]; - io_service [ label="io_service" ]; + io_context [ label="io_context" ]; io_object [ label="I/O Object\ne.g. socket" ]; your_program [ label="Your Program" ]; your_completion_handler [ label="Your Completion Handler" ]; @@ -39,12 +39,12 @@ digraph g edge [ arrowtail="diamond" ]; your_program:e -> your_completion_handler:n; your_program:w -> io_object:nw; - your_program:se -> io_service:ne; + your_program:se -> io_context:ne; } // Non-owning relationships; { - io_object:sw -> io_service:w; + io_object:sw -> io_context:w; } // Visible actions. @@ -54,8 +54,8 @@ digraph g // Forward actions. { your_program:sw -> io_object:n [ label="1" ]; - io_object:s -> io_service:nw [ label="2" ]; - io_service:s -> operating_system:n [ label="3" ]; + io_object:s -> io_context:nw [ label="2" ]; + io_context:s -> operating_system:n [ label="3" ]; } } @@ -65,14 +65,14 @@ digraph g // Forward actions. { - your_program:s -> io_service:n [ label="5" ]; + your_program:s -> io_context:n [ label="5" ]; } // Reverse actions. { edge [ arrowhead="none", arrowtail="open" ]; - //io_service:s -> operating_system:n [ label="4" ]; - your_completion_handler:s -> io_service:e [ label="6" ]; + //io_context:s -> operating_system:n [ label="4" ]; + your_completion_handler:s -> io_context:e [ label="6" ]; } } } diff --git a/asio/src/doc/overview/async_op1.png b/asio/src/doc/overview/async_op1.png index 0de79911..464bc90e 100644 Binary files a/asio/src/doc/overview/async_op1.png and b/asio/src/doc/overview/async_op1.png differ diff --git a/asio/src/doc/overview/async_op2.dot b/asio/src/doc/overview/async_op2.dot index 49067ac3..60a3275c 100644 --- a/asio/src/doc/overview/async_op2.dot +++ b/asio/src/doc/overview/async_op2.dot @@ -28,7 +28,7 @@ digraph g // Program elements. { operating_system [ label="Operating System", shape=ellipse ]; - io_service [ label="io_service" ]; + io_context [ label="io_context" ]; io_object [ label="I/O Object\ne.g. socket" ]; your_program [ label="Your Program" ]; your_completion_handler [ label="Your Completion Handler" ]; @@ -39,12 +39,12 @@ digraph g edge [ arrowtail="diamond" ]; your_program:e -> your_completion_handler:n; your_program:w -> io_object:nw; - your_program:se -> io_service:ne; + your_program:se -> io_context:ne; } // Non-owning relationships; { - io_object:sw -> io_service:w; + io_object:sw -> io_context:w; } // Visible actions. @@ -53,14 +53,14 @@ digraph g // Forward actions. { - your_program:s -> io_service:n [ label="5" ]; + your_program:s -> io_context:n [ label="5" ]; } // Reverse actions. { edge [ arrowhead="none", arrowtail="open" ]; - io_service:s -> operating_system:n [ label="4" ]; - your_completion_handler:s -> io_service:e [ label="6" ]; + io_context:s -> operating_system:n [ label="4" ]; + your_completion_handler:s -> io_context:e [ label="6" ]; } } @@ -71,8 +71,8 @@ digraph g // Forward actions. { your_program:sw -> io_object:n [ label="1" ]; - io_object:s -> io_service:nw [ label="2" ]; - //io_service:s -> operating_system:n [ label="3" ]; + io_object:s -> io_context:nw [ label="2" ]; + //io_context:s -> operating_system:n [ label="3" ]; } } } diff --git a/asio/src/doc/overview/async_op2.png b/asio/src/doc/overview/async_op2.png index 9b8d3c08..ba256ec8 100644 Binary files a/asio/src/doc/overview/async_op2.png and b/asio/src/doc/overview/async_op2.png differ diff --git a/asio/src/doc/overview/basics.qbk b/asio/src/doc/overview/basics.qbk index 7165b02c..a56a7a99 100644 --- a/asio/src/doc/overview/basics.qbk +++ b/asio/src/doc/overview/basics.qbk @@ -17,15 +17,15 @@ operations. [$sync_op.png] -[*Your program] will have at least one [*io_service] object. The [*io_service] +[*Your program] will have at least one [*io_context] object. The [*io_context] represents [*your program]'s link to the [*operating system]'s I/O services. - asio::io_service io_service; + asio::io_context io_context; To perform I/O operations [*your program] will need an [*I/O object] such as a TCP socket: - asio::ip::tcp::socket socket(io_service); + asio::ip::tcp::socket socket(io_context); When a synchronous connect operation is performed, the following sequence of events occurs: @@ -35,15 +35,15 @@ object]: socket.connect(server_endpoint); -2. The [*I/O object] forwards the request to the [*io_service]. +2. The [*I/O object] forwards the request to the [*io_context]. -3. The [*io_service] calls on the [*operating system] to perform the connect +3. The [*io_context] calls on the [*operating system] to perform the connect operation. 4. The [*operating system] returns the result of the operation to the -[*io_service]. +[*io_context]. -5. The [*io_service] translates any error resulting from the operation into an +5. The [*io_context] translates any error resulting from the operation into an object of type `asio::error_code`. An `error_code` may be compared with specific values, or tested as a boolean (where a `false` result means that no error occurred). The result is then forwarded back up to the [*I/O object]. @@ -76,9 +76,9 @@ The exact signature required depends on the asynchronous operation being performed. The reference documentation indicates the appropriate form for each operation. -2. The [*I/O object] forwards the request to the [*io_service]. +2. The [*I/O object] forwards the request to the [*io_context]. -3. The [*io_service] signals to the [*operating system] that it should start an +3. The [*io_context] signals to the [*operating system] that it should start an asynchronous connect. Time passes. (In the synchronous case this wait would have been contained @@ -87,15 +87,15 @@ entirely within the duration of the connect operation.) [$async_op2.png] 4. The [*operating system] indicates that the connect operation has completed -by placing the result on a queue, ready to be picked up by the [*io_service]. +by placing the result on a queue, ready to be picked up by the [*io_context]. -5. [*Your program] must make a call to `io_service::run()` (or to one of the -similar [*io_service] member functions) in order for the result to be -retrieved. A call to `io_service::run()` blocks while there are unfinished +5. [*Your program] must make a call to `io_context::run()` (or to one of the +similar [*io_context] member functions) in order for the result to be +retrieved. A call to `io_context::run()` blocks while there are unfinished asynchronous operations, so you would typically call it as soon as you have started your first asynchronous operation. -6. While inside the call to `io_service::run()`, the [*io_service] dequeues the +6. While inside the call to `io_context::run()`, the [*io_context] dequeues the result of the operation, translates it into an `error_code`, and then passes it to [*your completion handler]. diff --git a/asio/src/doc/overview/bsd_sockets.qbk b/asio/src/doc/overview/bsd_sockets.qbk index 261dd42a..644d1cce 100644 --- a/asio/src/doc/overview/bsd_sockets.qbk +++ b/asio/src/doc/overview/bsd_sockets.qbk @@ -166,10 +166,10 @@ The following table shows the mapping between the BSD socket API and Asio: [`poll()`, `select()`, `pselect()`] - [ [link asio.reference.io_service.run io_service::run()], - [link asio.reference.io_service.run_one io_service::run_one()], - [link asio.reference.io_service.poll io_service::poll()], - [link asio.reference.io_service.poll_one io_service::poll_one()] + [ [link asio.reference.io_context.run io_context::run()], + [link asio.reference.io_context.run_one io_context::run_one()], + [link asio.reference.io_context.poll io_context::poll()], + [link asio.reference.io_context.poll_one io_context::poll_one()] Note: in conjunction with asynchronous operations. ] ] diff --git a/asio/src/doc/overview/cpp2011.qbk b/asio/src/doc/overview/cpp2011.qbk index ec135340..2f1d5c9a 100644 --- a/asio/src/doc/overview/cpp2011.qbk +++ b/asio/src/doc/overview/cpp2011.qbk @@ -54,7 +54,7 @@ Windows handles. Move support allows you to write code like: - tcp::socket make_socket(io_service& i) + tcp::socket make_socket(io_context& i) { tcp::socket s(i); ... diff --git a/asio/src/doc/overview/handler_tracking.qbk b/asio/src/doc/overview/handler_tracking.qbk index 177cf234..7cbd28ab 100644 --- a/asio/src/doc/overview/handler_tracking.qbk +++ b/asio/src/doc/overview/handler_tracking.qbk @@ -67,7 +67,7 @@ The `` takes one of the following forms: [~n] [The handler number `n` was destroyed without having been invoked. This is usually the case for any unfinished asynchronous operations when the - `io_service` is destroyed.] + `io_context` is destroyed.] ] [ [n*m] diff --git a/asio/src/doc/overview/implementation.qbk b/asio/src/doc/overview/implementation.qbk index eec43a01..a6ac58c8 100644 --- a/asio/src/doc/overview/implementation.qbk +++ b/asio/src/doc/overview/implementation.qbk @@ -22,10 +22,10 @@ descriptors in the process cannot be permitted to exceed `FD_SETSIZE`. Threads: * Demultiplexing using `select` is performed in one of the threads that calls -`io_service::run()`, `io_service::run_one()`, `io_service::poll()` or -`io_service::poll_one()`. +`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or +`io_context::poll_one()`. -* An additional thread per `io_service` is used to emulate asynchronous host +* An additional thread per `io_context` is used to emulate asynchronous host resolution. This thread is created on the first call to either `ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`. @@ -42,10 +42,10 @@ Demultiplexing mechanism: Threads: * Demultiplexing using `epoll` is performed in one of the threads that calls -`io_service::run()`, `io_service::run_one()`, `io_service::poll()` or -`io_service::poll_one()`. +`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or +`io_context::poll_one()`. -* An additional thread per `io_service` is used to emulate asynchronous host +* An additional thread per `io_context` is used to emulate asynchronous host resolution. This thread is created on the first call to either `ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`. @@ -63,10 +63,10 @@ Demultiplexing mechanism: Threads: * Demultiplexing using [^/dev/poll] is performed in one of the threads that -calls `io_service::run()`, `io_service::run_one()`, `io_service::poll()` or -`io_service::poll_one()`. +calls `io_context::run()`, `io_context::run_one()`, `io_context::poll()` or +`io_context::poll_one()`. -* An additional thread per `io_service` is used to emulate asynchronous host +* An additional thread per `io_context` is used to emulate asynchronous host resolution. This thread is created on the first call to either `ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`. @@ -85,10 +85,10 @@ descriptors in the process cannot be permitted to exceed `FD_SETSIZE`. Threads: * Demultiplexing using `select` is performed in one of the threads that calls -`io_service::run()`, `io_service::run_one()`, `io_service::poll()` or -`io_service::poll_one()`. +`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or +`io_context::poll_one()`. -* An additional thread per `io_service` is used to emulate asynchronous host +* An additional thread per `io_context` is used to emulate asynchronous host resolution. This thread is created on the first call to either `ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`. @@ -106,10 +106,10 @@ Demultiplexing mechanism: Threads: * Demultiplexing using `kqueue` is performed in one of the threads that calls -`io_service::run()`, `io_service::run_one()`, `io_service::poll()` or -`io_service::poll_one()`. +`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or +`io_context::poll_one()`. -* An additional thread per `io_service` is used to emulate asynchronous host +* An additional thread per `io_context` is used to emulate asynchronous host resolution. This thread is created on the first call to either `ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`. @@ -127,10 +127,10 @@ Demultiplexing mechanism: Threads: * Demultiplexing using `kqueue` is performed in one of the threads that calls -`io_service::run()`, `io_service::run_one()`, `io_service::poll()` or -`io_service::poll_one()`. +`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or +`io_context::poll_one()`. -* An additional thread per `io_service` is used to emulate asynchronous host +* An additional thread per `io_context` is used to emulate asynchronous host resolution. This thread is created on the first call to either `ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`. @@ -149,10 +149,10 @@ descriptors in the process cannot be permitted to exceed `FD_SETSIZE`. Threads: * Demultiplexing using `select` is performed in one of the threads that calls -`io_service::run()`, `io_service::run_one()`, `io_service::poll()` or -`io_service::poll_one()`. +`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or +`io_context::poll_one()`. -* An additional thread per `io_service` is used to emulate asynchronous host +* An additional thread per `io_context` is used to emulate asynchronous host resolution. This thread is created on the first call to either `ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`. @@ -171,10 +171,10 @@ descriptors in the process cannot be permitted to exceed `FD_SETSIZE`. Threads: * Demultiplexing using `select` is performed in one of the threads that calls -`io_service::run()`, `io_service::run_one()`, `io_service::poll()` or -`io_service::poll_one()`. +`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or +`io_context::poll_one()`. -* An additional thread per `io_service` is used to emulate asynchronous host +* An additional thread per `io_context` is used to emulate asynchronous host resolution. This thread is created on the first call to either `ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`. @@ -193,10 +193,10 @@ descriptors in the process cannot be permitted to exceed `FD_SETSIZE`. Threads: * Demultiplexing using `select` is performed in one of the threads that calls -`io_service::run()`, `io_service::run_one()`, `io_service::poll()` or -`io_service::poll_one()`. +`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or +`io_context::poll_one()`. -* An additional thread per `io_service` is used to emulate asynchronous host +* An additional thread per `io_context` is used to emulate asynchronous host resolution. This thread is created on the first call to either `ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`. @@ -214,10 +214,10 @@ Demultiplexing mechanism: Threads: * Demultiplexing using `select` is performed in one of the threads that calls -`io_service::run()`, `io_service::run_one()`, `io_service::poll()` or -`io_service::poll_one()`. +`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or +`io_context::poll_one()`. -* An additional thread per `io_service` is used to emulate asynchronous host +* An additional thread per `io_context` is used to emulate asynchronous host resolution. This thread is created on the first call to either `ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`. @@ -238,17 +238,17 @@ operations except for asynchronous connect. Threads: * Demultiplexing using I/O completion ports is performed in all threads that call -`io_service::run()`, `io_service::run_one()`, `io_service::poll()` or -`io_service::poll_one()`. +`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or +`io_context::poll_one()`. -* An additional thread per `io_service` is used to trigger timers. This thread +* An additional thread per `io_context` is used to trigger timers. This thread is created on construction of the first `deadline_timer` or `deadline_timer_service` objects. -* An additional thread per `io_service` is used for the `select` +* An additional thread per `io_context` is used for the `select` demultiplexing. This thread is created on the first call to `async_connect()`. -* An additional thread per `io_service` is used to emulate asynchronous host +* An additional thread per `io_context` is used to emulate asynchronous host resolution. This thread is created on the first call to either `ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`. @@ -265,7 +265,7 @@ Asio provides limited support for the Windows Runtime. It requires that the language extensions be enabled. Due to the restricted facilities exposed by the Windows Runtime API, the support comes with the following caveats: -* The core facilities such as the `io_service`, `strand`, buffers, composed +* The core facilities such as the `io_context`, `strand`, buffers, composed operations, timers, etc., should all work as normal. * For sockets, only client-side TCP is supported. @@ -292,9 +292,9 @@ Demultiplexing mechanism: Threads: * Event completions are delivered to the Windows thread pool and posted to the - `io_service` for the handler to be executed. + `io_context` for the handler to be executed. -* An additional thread per `io_service` is used to trigger timers. This thread +* An additional thread per `io_context` is used to trigger timers. This thread is created on construction of the first timer objects. Scatter-Gather: diff --git a/asio/src/doc/overview/iostreams.qbk b/asio/src/doc/overview/iostreams.qbk index 588d96a3..096b4ebc 100644 --- a/asio/src/doc/overview/iostreams.qbk +++ b/asio/src/doc/overview/iostreams.qbk @@ -20,7 +20,7 @@ independence, etc. To create a connection one might simply write: The iostream class can also be used in conjunction with an acceptor to create simple servers. For example: - io_service ios; + io_context ioc; ip::tcp::endpoint endpoint(tcp::v4(), 80); ip::tcp::acceptor acceptor(ios, endpoint); diff --git a/asio/src/doc/overview/other_protocols.qbk b/asio/src/doc/overview/other_protocols.qbk index 0ef323da..2921581f 100644 --- a/asio/src/doc/overview/other_protocols.qbk +++ b/asio/src/doc/overview/other_protocols.qbk @@ -22,7 +22,7 @@ These classes implement the [link asio.reference.Protocol protocol type requirements], but allow the user to specify the address family (e.g. `AF_INET`) and protocol type (e.g. `IPPROTO_TCP`) at runtime. For example: - asio::generic::stream_protocol::socket my_socket(my_io_service); + asio::generic::stream_protocol::socket my_socket(my_io_context); my_socket.open(asio::generic::stream_protocol(AF_INET, IPPROTO_TCP)); ... @@ -38,7 +38,7 @@ endpoint] type requirements: The conversion is implicit, so as to support the following use cases: - asio::generic::stream_protocol::socket my_socket(my_io_service); + asio::generic::stream_protocol::socket my_socket(my_io_context); asio::ip::tcp::endpoint my_endpoint = ...; my_socket.connect(my_endpoint); @@ -53,14 +53,14 @@ type. If the protocol conversion is valid: then the corresponding socket conversion is allowed: - Protocol1::socket my_socket1(my_io_service); + Protocol1::socket my_socket1(my_io_context); ... Protocol2::socket my_socket2(std::move(my_socket1)); For example, one possible conversion is from a TCP socket to a generic stream-oriented socket: - asio::ip::tcp::socket my_socket1(my_io_service); + asio::ip::tcp::socket my_socket1(my_io_context); ... asio::generic::stream_protocol::socket my_socket2(std::move(my_socket1)); @@ -78,9 +78,9 @@ corresponding protocol conversion is valid. For example, the following is supported because the protocol `asio::ip::tcp` is convertible to `asio::generic::stream_protocol`: - asio::ip::tcp::acceptor my_acceptor(my_io_service); + asio::ip::tcp::acceptor my_acceptor(my_io_context); ... - asio::generic::stream_protocol::socket my_socket(my_io_service); + asio::generic::stream_protocol::socket my_socket(my_io_context); my_acceptor.accept(my_socket); [heading See Also] diff --git a/asio/src/doc/overview/posix.qbk b/asio/src/doc/overview/posix.qbk index 49a62150..4aa6bb9b 100644 --- a/asio/src/doc/overview/posix.qbk +++ b/asio/src/doc/overview/posix.qbk @@ -19,15 +19,15 @@ Asio provides basic support UNIX domain sockets (also known as local sockets). The simplest use involves creating a pair of connected sockets. The following code: - local::stream_protocol::socket socket1(my_io_service); - local::stream_protocol::socket socket2(my_io_service); + local::stream_protocol::socket socket1(my_io_context); + local::stream_protocol::socket socket2(my_io_context); local::connect_pair(socket1, socket2); will create a pair of stream-oriented sockets. To do the same for datagram-oriented sockets, use: - local::datagram_protocol::socket socket1(my_io_service); - local::datagram_protocol::socket socket2(my_io_service); + local::datagram_protocol::socket socket1(my_io_context); + local::datagram_protocol::socket socket2(my_io_context); local::connect_pair(socket1, socket2); A UNIX domain socket server may be created by binding an acceptor to an @@ -35,14 +35,14 @@ endpoint, in much the same way as one does for a TCP server: ::unlink("/tmp/foobar"); // Remove previous binding. local::stream_protocol::endpoint ep("/tmp/foobar"); - local::stream_protocol::acceptor acceptor(my_io_service, ep); - local::stream_protocol::socket socket(my_io_service); + local::stream_protocol::acceptor acceptor(my_io_context, ep); + local::stream_protocol::socket socket(my_io_context); acceptor.accept(socket); A client that connects to this server might look like: local::stream_protocol::endpoint ep("/tmp/foobar"); - local::stream_protocol::socket socket(my_io_service); + local::stream_protocol::socket socket(my_io_context); socket.connect(ep); Transmission of file descriptors or credentials across UNIX domain sockets is @@ -80,8 +80,8 @@ standard input and output, and various devices (but /not/ regular files). For example, to perform read and write operations on standard input and output, the following objects may be created: - posix::stream_descriptor in(my_io_service, ::dup(STDIN_FILENO)); - posix::stream_descriptor out(my_io_service, ::dup(STDOUT_FILENO)); + posix::stream_descriptor in(my_io_context, ::dup(STDIN_FILENO)); + posix::stream_descriptor out(my_io_context, ::dup(STDOUT_FILENO)); These are then used as synchronous or asynchronous read and write streams. This means the objects can be used with any of the [link asio.reference.read @@ -109,25 +109,25 @@ target operating system. A program may test for the macro [section:fork Fork] Asio supports programs that utilise the `fork()` system call. Provided the -program calls `io_service.notify_fork()` at the appropriate times, Asio will +program calls `io_context.notify_fork()` at the appropriate times, Asio will recreate any internal file descriptors (such as the "self-pipe trick" descriptor used for waking up a reactor). The notification is usually performed as follows: - io_service_.notify_fork(asio::io_service::fork_prepare); + io_context_.notify_fork(asio::io_context::fork_prepare); if (fork() == 0) { - io_service_.notify_fork(asio::io_service::fork_child); + io_context_.notify_fork(asio::io_context::fork_child); ... } else { - io_service_.notify_fork(asio::io_service::fork_parent); + io_context_.notify_fork(asio::io_context::fork_parent); ... } User-defined services can also be made fork-aware by overriding the -`io_service::service::fork_service()` virtual function. +`io_context::service::fork_service()` virtual function. Note that any file descriptors accessible via Asio's public API (e.g. the descriptors underlying `basic_socket<>`, `posix::stream_descriptor`, etc.) are @@ -136,9 +136,9 @@ as required. [heading See Also] -[link asio.reference.io_service.notify_fork io_service::notify_fork()], -[link asio.reference.io_service.fork_event io_service::fork_event], -[link asio.reference.execution_context__service.fork_service io_service::service::fork_service()], +[link asio.reference.io_context.notify_fork io_context::notify_fork()], +[link asio.reference.io_context.fork_event io_context::fork_event], +[link asio.reference.execution_context__service.fork_service io_context::service::fork_service()], [link asio.examples.cpp03_examples.fork Fork examples]. [endsect] diff --git a/asio/src/doc/overview/protocols.qbk b/asio/src/doc/overview/protocols.qbk index bf37fec5..fd48d290 100644 --- a/asio/src/doc/overview/protocols.qbk +++ b/asio/src/doc/overview/protocols.qbk @@ -15,7 +15,7 @@ ICMP. Hostname resolution is performed using a resolver, where host and service names are looked up and converted into one or more endpoints: - ip::tcp::resolver resolver(my_io_service); + ip::tcp::resolver resolver(my_io_context); ip::tcp::resolver::query query("www.boost.org", "http"); ip::tcp::resolver::iterator iter = resolver.resolve(query); ip::tcp::resolver::iterator end; // End marker. @@ -35,7 +35,7 @@ connect()] and [link asio.reference.async_connect async_connect()]. These operations try each endpoint in a list until the socket is successfully connected. For example, a single call: - ip::tcp::socket socket(my_io_service); + ip::tcp::socket socket(my_io_context); asio::connect(socket, resolver.resolve(query)); will synchronously try all endpoints until one is successfully connected. @@ -61,7 +61,7 @@ Similarly, an asynchronous connect may be performed by writing: When a specific endpoint is available, a socket can be created and connected: - ip::tcp::socket socket(my_io_service); + ip::tcp::socket socket(my_io_context); socket.connect(endpoint); Data may be read from or written to a connected TCP socket using the [link @@ -79,9 +79,9 @@ asio.reference.async_write async_write()]. A program uses an acceptor to accept incoming TCP connections: - ip::tcp::acceptor acceptor(my_io_service, my_endpoint); + ip::tcp::acceptor acceptor(my_io_context, my_endpoint); ... - ip::tcp::socket socket(my_io_service); + ip::tcp::socket socket(my_io_context); acceptor.accept(socket); After a socket has been successfully accepted, it may be read from or written @@ -91,7 +91,7 @@ to as illustrated for TCP clients above. UDP hostname resolution is also performed using a resolver: - ip::udp::resolver resolver(my_io_service); + ip::udp::resolver resolver(my_io_context); ip::udp::resolver::query query("localhost", "daytime"); ip::udp::resolver::iterator iter = resolver.resolve(query); ... @@ -101,7 +101,7 @@ create an IP version 4 UDP socket and bind it to the "any" address on port `12345`: ip::udp::endpoint endpoint(ip::udp::v4(), 12345); - ip::udp::socket socket(my_io_service, endpoint); + ip::udp::socket socket(my_io_context, endpoint); Data may be read from or written to an unconnected UDP socket using the [link asio.reference.basic_datagram_socket.receive_from receive_from()], [link @@ -118,7 +118,7 @@ asio.reference.basic_datagram_socket.async_send async_send()] member functions. As with TCP and UDP, ICMP hostname resolution is performed using a resolver: - ip::icmp::resolver resolver(my_io_service); + ip::icmp::resolver resolver(my_io_context); ip::icmp::resolver::query query("localhost", ""); ip::icmp::resolver::iterator iter = resolver.resolve(query); ... @@ -127,7 +127,7 @@ An ICMP socket may be bound to a local endpoint. The following code will create an IP version 6 ICMP socket and bind it to the "any" address: ip::icmp::endpoint endpoint(ip::icmp::v6(), 0); - ip::icmp::socket socket(my_io_service, endpoint); + ip::icmp::socket socket(my_io_context, endpoint); The port number is not used for ICMP. diff --git a/asio/src/doc/overview/reactor.qbk b/asio/src/doc/overview/reactor.qbk index f28a60ef..68559b79 100644 --- a/asio/src/doc/overview/reactor.qbk +++ b/asio/src/doc/overview/reactor.qbk @@ -15,7 +15,7 @@ to become ready to read, ready to write, or to have a pending error condition. As an example, to perform a non-blocking read something like the following may be used: - ip::tcp::socket socket(my_io_service); + ip::tcp::socket socket(my_io_context); ... socket.non_blocking(true); ... diff --git a/asio/src/doc/overview/serial_ports.qbk b/asio/src/doc/overview/serial_ports.qbk index 876678dd..843c9a53 100644 --- a/asio/src/doc/overview/serial_ports.qbk +++ b/asio/src/doc/overview/serial_ports.qbk @@ -10,7 +10,7 @@ Asio includes classes for creating and manipulating serial ports in a portable manner. For example, a serial port may be opened using: - serial_port port(my_io_service, name); + serial_port port(my_io_context, name); where name is something like `"COM1"` on Windows, and `"/dev/ttyS0"` on POSIX platforms. diff --git a/asio/src/doc/overview/signals.qbk b/asio/src/doc/overview/signals.qbk index ea16be2c..1d46f692 100644 --- a/asio/src/doc/overview/signals.qbk +++ b/asio/src/doc/overview/signals.qbk @@ -27,7 +27,7 @@ however the signal number must be used only with Asio. ... // Construct a signal set registered for process termination. - asio::signal_set signals(io_service, SIGINT, SIGTERM); + asio::signal_set signals(io_context, SIGINT, SIGTERM); // Start an asynchronous wait for one of the signals to occur. signals.async_wait(handler); diff --git a/asio/src/doc/overview/spawn.qbk b/asio/src/doc/overview/spawn.qbk index b8972227..03954a96 100644 --- a/asio/src/doc/overview/spawn.qbk +++ b/asio/src/doc/overview/spawn.qbk @@ -38,8 +38,8 @@ synchronous manner, as shown in the following example: } The first argument to `spawn()` may be a -[link asio.reference.io_service__strand `strand`], -[link asio.reference.io_service `io_service`], or +[link asio.reference.io_context__strand `strand`], +[link asio.reference.io_context `io_context`], or [link asio.reference.CompletionHandler completion handler]. This argument determines the context in which the coroutine is permitted to execute. For example, a server's per-client object may consist of multiple diff --git a/asio/src/doc/overview/ssl.qbk b/asio/src/doc/overview/ssl.qbk index cb9e3d70..9d063efe 100644 --- a/asio/src/doc/overview/ssl.qbk +++ b/asio/src/doc/overview/ssl.qbk @@ -22,7 +22,7 @@ initialisation may look something like: To use SSL with a TCP socket, one may write: - ssl::stream ssl_sock(my_io_service, ctx); + ssl::stream ssl_sock(my_io_context, ctx); To perform socket-specific operations, such as establishing an outbound connection or accepting an incoming one, the underlying socket must first be @@ -36,7 +36,7 @@ In some use cases the underlying stream object will need to have a longer lifetime than the SSL stream, in which case the template parameter should be a reference to the stream type: - ip::tcp::socket sock(my_io_service); + ip::tcp::socket sock(my_io_context); ssl::stream ssl_sock(sock, ctx); SSL handshaking must be performed prior to transmitting or receiving data over @@ -82,9 +82,9 @@ according to the rules used by HTTPS: ctx.set_default_verify_paths(); // Open a socket and connect it to the remote host. - asio::io_service io_service; - ssl_socket sock(io_service, ctx); - tcp::resolver resolver(io_service); + asio::io_context io_context; + ssl_socket sock(io_context, ctx); + tcp::resolver resolver(io_context); tcp::resolver::query query("host.name", "https"); asio::connect(sock.lowest_layer(), resolver.resolve(query)); sock.lowest_layer().set_option(tcp::no_delay(true)); diff --git a/asio/src/doc/overview/strands.qbk b/asio/src/doc/overview/strands.qbk index 7e0982b5..0d4a08bf 100644 --- a/asio/src/doc/overview/strands.qbk +++ b/asio/src/doc/overview/strands.qbk @@ -15,8 +15,8 @@ mutexes). Strands may be either implicit or explicit, as illustrated by the following alternative approaches: -* Calling io_service::run() from only one thread means all event handlers - execute in an implicit strand, due to the io_service's guarantee that handlers +* Calling io_context::run() from only one thread means all event handlers + execute in an implicit strand, due to the io_context's guarantee that handlers are only invoked from inside run(). * Where there is a single chain of asynchronous operations associated with a @@ -24,7 +24,7 @@ alternative approaches: no possibility of concurrent execution of the handlers. This is an implicit strand. -* An explicit strand is an instance of `strand<>` or `io_service::strand`. All +* An explicit strand is an instance of `strand<>` or `io_context::strand`. All event handler function objects need to be bound to the strand using `asio::bind_executor()` or otherwise posted/dispatched through the strand object. @@ -78,7 +78,7 @@ bind a strand to a completion handler we would simply write: [link asio.reference.bind_executor bind_executor], [link asio.reference.strand strand], -[link asio.reference.io_service__strand io_service::strand], +[link asio.reference.io_context__strand io_context::strand], [link asio.tutorial.tuttimer5 tutorial Timer.5], [link asio.examples.cpp03_examples.http_server_3 HTTP server 3 example]. diff --git a/asio/src/doc/overview/sync_op.dot b/asio/src/doc/overview/sync_op.dot index 32e3e9cc..f3eb4dd4 100644 --- a/asio/src/doc/overview/sync_op.dot +++ b/asio/src/doc/overview/sync_op.dot @@ -28,7 +28,7 @@ digraph g // Program elements. { operating_system [ label="Operating System", shape=ellipse ]; - io_service [ label="io_service" ]; + io_context [ label="io_context" ]; io_object [ label="I/O Object\ne.g. socket" ]; your_program [ label="Your Program" ]; } @@ -37,12 +37,12 @@ digraph g { edge [ arrowtail="diamond" ]; your_program:w -> io_object:nw; - your_program:se -> io_service:ne; + your_program:se -> io_context:ne; } // Non-owning relationships; { - io_object:sw -> io_service:w; + io_object:sw -> io_context:w; } // Actions. @@ -52,15 +52,15 @@ digraph g // Forward actions. { your_program:sw -> io_object:n [ label="1" ]; - io_object:s -> io_service:nw [ label="2" ]; - io_service:sw -> operating_system:nw [ label="3" ]; + io_object:s -> io_context:nw [ label="2" ]; + io_context:sw -> operating_system:nw [ label="3" ]; } // Reverse actions. { edge [ arrowhead="none", arrowtail="open" ]; - io_service:se -> operating_system:ne [ label="4" ]; - io_object:se -> io_service:n [ label="5" ]; + io_context:se -> operating_system:ne [ label="4" ]; + io_object:se -> io_context:n [ label="5" ]; your_program:s -> io_object:ne [ label="6" ]; } } diff --git a/asio/src/doc/overview/sync_op.png b/asio/src/doc/overview/sync_op.png index 12324631..a96c8351 100644 Binary files a/asio/src/doc/overview/sync_op.png and b/asio/src/doc/overview/sync_op.png differ diff --git a/asio/src/doc/overview/threads.qbk b/asio/src/doc/overview/threads.qbk index 0b2ea9ec..471dc1be 100644 --- a/asio/src/doc/overview/threads.qbk +++ b/asio/src/doc/overview/threads.qbk @@ -10,19 +10,19 @@ [heading Thread Safety] In general, it is safe to make concurrent use of distinct objects, but unsafe -to make concurrent use of a single object. However, types such as `io_service` +to make concurrent use of a single object. However, types such as `io_context` provide a stronger guarantee that it is safe to use a single object concurrently. [heading Thread Pools] -Multiple threads may call `io_service::run()` to set up a pool of threads from +Multiple threads may call `io_context::run()` to set up a pool of threads from which completion handlers may be invoked. This approach may also be used with -`io_service::post()` to use a means to perform any computational tasks across a +`io_context::post()` to use a means to perform any computational tasks across a thread pool. -Note that all threads that have joined an `io_service`'s pool are considered -equivalent, and the `io_service` may distribute work across them in an +Note that all threads that have joined an `io_context`'s pool are considered +equivalent, and the `io_context` may distribute work across them in an arbitrary fashion. [heading Internal Threads] @@ -38,14 +38,14 @@ these threads must be invisible to the library user. In particular, the threads: This approach is complemented by the following guarantee: * Asynchronous completion handlers will only be called from threads that are - currently calling `io_service::run()`. + currently calling `io_context::run()`. Consequently, it is the library user's responsibility to create and manage all threads to which the notifications will be delivered. The reasons for this approach include: -* By only calling `io_service::run()` from a single thread, the user's code can +* By only calling `io_context::run()` from a single thread, the user's code can avoid the development complexity associated with synchronisation. For example, a library user can implement scalable servers that are single-threaded (from the user's point of view). @@ -61,6 +61,6 @@ The reasons for this approach include: [heading See Also] -[link asio.reference.io_service io_service]. +[link asio.reference.io_context io_context]. [endsect] diff --git a/asio/src/doc/overview/timers.qbk b/asio/src/doc/overview/timers.qbk index 882ebed8..2a4a5e5b 100644 --- a/asio/src/doc/overview/timers.qbk +++ b/asio/src/doc/overview/timers.qbk @@ -14,7 +14,7 @@ calculated relative to the current time. As a simple example, to perform a synchronous wait operation on a timer using a relative time one may write: - io_service i; + io_context i; ... deadline_timer t(i); t.expires_from_now(boost::posix_time::seconds(5)); @@ -25,7 +25,7 @@ timer: void handler(asio::error_code ec) { ... } ... - io_service i; + io_context i; ... deadline_timer t(i); t.expires_from_now(boost::posix_time::milliseconds(400)); diff --git a/asio/src/doc/overview/windows.qbk b/asio/src/doc/overview/windows.qbk index 5aecc379..7fabe0f5 100644 --- a/asio/src/doc/overview/windows.qbk +++ b/asio/src/doc/overview/windows.qbk @@ -22,7 +22,7 @@ For example, to perform asynchronous operations on a named pipe, the following object may be created: HANDLE handle = ::CreateFile(...); - windows::stream_handle pipe(my_io_service, handle); + windows::stream_handle pipe(my_io_context, handle); These are then used as synchronous or asynchronous read and write streams. This means the objects can be used with any of the [link asio.reference.read @@ -61,7 +61,7 @@ For example, to perform asynchronous operations on a file the following object may be created: HANDLE handle = ::CreateFile(...); - windows::random_access_handle file(my_io_service, handle); + windows::random_access_handle file(my_io_context, handle); Data may be read from or written to the handle using one of the `read_some_at()`, `async_read_some_at()`, `write_some_at()` or @@ -110,7 +110,7 @@ For example, to perform asynchronous operations on an event, the following object may be created: HANDLE handle = ::CreateEvent(...); - windows::object_handle file(my_io_service, handle); + windows::object_handle file(my_io_context, handle); The `wait()` and `async_wait()` member functions may then be used to wait until the kernel object is signalled. diff --git a/asio/src/doc/quickref.xml b/asio/src/doc/quickref.xml index 49f72d32..7a2631a8 100644 --- a/asio/src/doc/quickref.xml +++ b/asio/src/doc/quickref.xml @@ -34,11 +34,11 @@ executor executor_arg_t invalid_service_owner - io_service - io_service::executor_type - io_service::service - io_service::strand - io_service::work + io_context + io_context::executor_type + io_context::service + io_context::strand + io_context::work service_already_exists system_error system_executor diff --git a/asio/src/examples/cpp03/Makefile.am b/asio/src/examples/cpp03/Makefile.am index f8113661..2194b0eb 100644 --- a/asio/src/examples/cpp03/Makefile.am +++ b/asio/src/examples/cpp03/Makefile.am @@ -116,7 +116,7 @@ http_server_http_server_SOURCES = \ http/server/server.cpp http_server2_http_server_SOURCES = \ http/server2/connection.cpp \ - http/server2/io_service_pool.cpp \ + http/server2/io_context_pool.cpp \ http/server2/main.cpp \ http/server2/mime_types.cpp \ http/server2/reply.cpp \ @@ -207,7 +207,7 @@ EXTRA_DIST = \ http/server/request_parser.hpp \ http/server/server.hpp \ http/server2/connection.hpp \ - http/server2/io_service_pool.hpp \ + http/server2/io_context_pool.hpp \ http/server2/header.hpp \ http/server2/mime_types.hpp \ http/server2/reply.hpp \ diff --git a/asio/src/examples/cpp03/allocation/server.cpp b/asio/src/examples/cpp03/allocation/server.cpp index ee320589..e2af6e91 100644 --- a/asio/src/examples/cpp03/allocation/server.cpp +++ b/asio/src/examples/cpp03/allocation/server.cpp @@ -120,8 +120,8 @@ class session : public boost::enable_shared_from_this { public: - session(asio::io_service& io_service) - : socket_(io_service) + session(asio::io_context& io_context) + : socket_(io_context) { } @@ -183,11 +183,11 @@ typedef boost::shared_ptr session_ptr; class server { public: - server(asio::io_service& io_service, short port) - : io_service_(io_service), - acceptor_(io_service, tcp::endpoint(tcp::v4(), port)) + server(asio::io_context& io_context, short port) + : io_context_(io_context), + acceptor_(io_context, tcp::endpoint(tcp::v4(), port)) { - session_ptr new_session(new session(io_service_)); + session_ptr new_session(new session(io_context_)); acceptor_.async_accept(new_session->socket(), boost::bind(&server::handle_accept, this, new_session, asio::placeholders::error)); @@ -201,14 +201,14 @@ public: new_session->start(); } - new_session.reset(new session(io_service_)); + new_session.reset(new session(io_context_)); acceptor_.async_accept(new_session->socket(), boost::bind(&server::handle_accept, this, new_session, asio::placeholders::error)); } private: - asio::io_service& io_service_; + asio::io_context& io_context_; tcp::acceptor acceptor_; }; @@ -222,12 +222,12 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; using namespace std; // For atoi. - server s(io_service, atoi(argv[1])); + server s(io_context, atoi(argv[1])); - io_service.run(); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/buffers/reference_counted.cpp b/asio/src/examples/cpp03/buffers/reference_counted.cpp index aaea2abb..14b4a0b8 100644 --- a/asio/src/examples/cpp03/buffers/reference_counted.cpp +++ b/asio/src/examples/cpp03/buffers/reference_counted.cpp @@ -43,8 +43,8 @@ class session : public boost::enable_shared_from_this { public: - session(asio::io_service& io_service) - : socket_(io_service) + session(asio::io_context& io_context) + : socket_(io_context) { } @@ -76,11 +76,11 @@ typedef boost::shared_ptr session_ptr; class server { public: - server(asio::io_service& io_service, short port) - : io_service_(io_service), - acceptor_(io_service, tcp::endpoint(tcp::v4(), port)) + server(asio::io_context& io_context, short port) + : io_context_(io_context), + acceptor_(io_context, tcp::endpoint(tcp::v4(), port)) { - session_ptr new_session(new session(io_service_)); + session_ptr new_session(new session(io_context_)); acceptor_.async_accept(new_session->socket(), boost::bind(&server::handle_accept, this, new_session, asio::placeholders::error)); @@ -94,14 +94,14 @@ public: new_session->start(); } - new_session.reset(new session(io_service_)); + new_session.reset(new session(io_context_)); acceptor_.async_accept(new_session->socket(), boost::bind(&server::handle_accept, this, new_session, asio::placeholders::error)); } private: - asio::io_service& io_service_; + asio::io_context& io_context_; tcp::acceptor acceptor_; }; @@ -115,12 +115,12 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; using namespace std; // For atoi. - server s(io_service, atoi(argv[1])); + server s(io_context, atoi(argv[1])); - io_service.run(); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/chat/chat_client.cpp b/asio/src/examples/cpp03/chat/chat_client.cpp index ca667475..1820341e 100644 --- a/asio/src/examples/cpp03/chat/chat_client.cpp +++ b/asio/src/examples/cpp03/chat/chat_client.cpp @@ -22,10 +22,10 @@ typedef std::deque chat_message_queue; class chat_client { public: - chat_client(asio::io_service& io_service, + chat_client(asio::io_context& io_context, const tcp::resolver::results_type& endpoints) - : io_service_(io_service), - socket_(io_service) + : io_context_(io_context), + socket_(io_context) { asio::async_connect(socket_, endpoints, boost::bind(&chat_client::handle_connect, this, @@ -34,13 +34,13 @@ public: void write(const chat_message& msg) { - asio::post(io_service_, + asio::post(io_context_, boost::bind(&chat_client::do_write, this, msg)); } void close() { - asio::post(io_service_, + asio::post(io_context_, boost::bind(&chat_client::do_close, this)); } @@ -129,7 +129,7 @@ private: } private: - asio::io_service& io_service_; + asio::io_context& io_context_; tcp::socket socket_; chat_message read_msg_; chat_message_queue write_msgs_; @@ -145,14 +145,14 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; - tcp::resolver resolver(io_service); + tcp::resolver resolver(io_context); tcp::resolver::results_type endpoints = resolver.resolve(argv[1], argv[2]); - chat_client c(io_service, endpoints); + chat_client c(io_context, endpoints); - asio::thread t(boost::bind(&asio::io_service::run, &io_service)); + asio::thread t(boost::bind(&asio::io_context::run, &io_context)); char line[chat_message::max_body_length + 1]; while (std::cin.getline(line, chat_message::max_body_length + 1)) diff --git a/asio/src/examples/cpp03/chat/chat_server.cpp b/asio/src/examples/cpp03/chat/chat_server.cpp index ce62316b..c5b4f6fc 100644 --- a/asio/src/examples/cpp03/chat/chat_server.cpp +++ b/asio/src/examples/cpp03/chat/chat_server.cpp @@ -77,8 +77,8 @@ class chat_session public boost::enable_shared_from_this { public: - chat_session(asio::io_service& io_service, chat_room& room) - : socket_(io_service), + chat_session(asio::io_context& io_context, chat_room& room) + : socket_(io_context), room_(room) { } @@ -177,17 +177,17 @@ typedef boost::shared_ptr chat_session_ptr; class chat_server { public: - chat_server(asio::io_service& io_service, + chat_server(asio::io_context& io_context, const tcp::endpoint& endpoint) - : io_service_(io_service), - acceptor_(io_service, endpoint) + : io_context_(io_context), + acceptor_(io_context, endpoint) { start_accept(); } void start_accept() { - chat_session_ptr new_session(new chat_session(io_service_, room_)); + chat_session_ptr new_session(new chat_session(io_context_, room_)); acceptor_.async_accept(new_session->socket(), boost::bind(&chat_server::handle_accept, this, new_session, asio::placeholders::error)); @@ -205,7 +205,7 @@ public: } private: - asio::io_service& io_service_; + asio::io_context& io_context_; tcp::acceptor acceptor_; chat_room room_; }; @@ -225,18 +225,18 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; chat_server_list servers; for (int i = 1; i < argc; ++i) { using namespace std; // For atoi. tcp::endpoint endpoint(tcp::v4(), atoi(argv[i])); - chat_server_ptr server(new chat_server(io_service, endpoint)); + chat_server_ptr server(new chat_server(io_context, endpoint)); servers.push_back(server); } - io_service.run(); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/chat/posix_chat_client.cpp b/asio/src/examples/cpp03/chat/posix_chat_client.cpp index f25872cf..9e7dea31 100644 --- a/asio/src/examples/cpp03/chat/posix_chat_client.cpp +++ b/asio/src/examples/cpp03/chat/posix_chat_client.cpp @@ -24,11 +24,11 @@ namespace posix = asio::posix; class posix_chat_client { public: - posix_chat_client(asio::io_service& io_service, + posix_chat_client(asio::io_context& io_context, const tcp::resolver::results_type& endpoints) - : socket_(io_service), - input_(io_service, ::dup(STDIN_FILENO)), - output_(io_service, ::dup(STDOUT_FILENO)), + : socket_(io_context), + input_(io_context, ::dup(STDIN_FILENO)), + output_(io_context, ::dup(STDOUT_FILENO)), input_buffer_(chat_message::max_body_length) { asio::async_connect(socket_, endpoints, @@ -182,14 +182,14 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; - tcp::resolver resolver(io_service); + tcp::resolver resolver(io_context); tcp::resolver::results_type endpoints = resolver.resolve(argv[1], argv[2]); - posix_chat_client c(io_service, endpoints); + posix_chat_client c(io_context, endpoints); - io_service.run(); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/echo/async_tcp_echo_server.cpp b/asio/src/examples/cpp03/echo/async_tcp_echo_server.cpp index 0328c027..bc930704 100644 --- a/asio/src/examples/cpp03/echo/async_tcp_echo_server.cpp +++ b/asio/src/examples/cpp03/echo/async_tcp_echo_server.cpp @@ -18,8 +18,8 @@ using asio::ip::tcp; class session { public: - session(asio::io_service& io_service) - : socket_(io_service) + session(asio::io_context& io_context) + : socket_(io_context) { } @@ -76,9 +76,9 @@ private: class server { public: - server(asio::io_service& io_service, short port) - : io_service_(io_service), - acceptor_(io_service, tcp::endpoint(tcp::v4(), port)) + server(asio::io_context& io_context, short port) + : io_context_(io_context), + acceptor_(io_context, tcp::endpoint(tcp::v4(), port)) { start_accept(); } @@ -86,7 +86,7 @@ public: private: void start_accept() { - session* new_session = new session(io_service_); + session* new_session = new session(io_context_); acceptor_.async_accept(new_session->socket(), boost::bind(&server::handle_accept, this, new_session, asio::placeholders::error)); @@ -107,7 +107,7 @@ private: start_accept(); } - asio::io_service& io_service_; + asio::io_context& io_context_; tcp::acceptor acceptor_; }; @@ -121,12 +121,12 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; using namespace std; // For atoi. - server s(io_service, atoi(argv[1])); + server s(io_context, atoi(argv[1])); - io_service.run(); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/echo/async_udp_echo_server.cpp b/asio/src/examples/cpp03/echo/async_udp_echo_server.cpp index 36dc95f5..64a4fa4c 100644 --- a/asio/src/examples/cpp03/echo/async_udp_echo_server.cpp +++ b/asio/src/examples/cpp03/echo/async_udp_echo_server.cpp @@ -18,8 +18,8 @@ using asio::ip::udp; class server { public: - server(asio::io_service& io_service, short port) - : socket_(io_service, udp::endpoint(udp::v4(), port)) + server(asio::io_context& io_context, short port) + : socket_(io_context, udp::endpoint(udp::v4(), port)) { socket_.async_receive_from( asio::buffer(data_, max_length), sender_endpoint_, @@ -76,12 +76,12 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; using namespace std; // For atoi. - server s(io_service, atoi(argv[1])); + server s(io_context, atoi(argv[1])); - io_service.run(); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/echo/blocking_tcp_echo_client.cpp b/asio/src/examples/cpp03/echo/blocking_tcp_echo_client.cpp index 202e5d92..fa19c5d0 100644 --- a/asio/src/examples/cpp03/echo/blocking_tcp_echo_client.cpp +++ b/asio/src/examples/cpp03/echo/blocking_tcp_echo_client.cpp @@ -27,13 +27,13 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; - tcp::resolver resolver(io_service); + tcp::resolver resolver(io_context); tcp::resolver::results_type endpoints = resolver.resolve(tcp::v4(), argv[1], argv[2]); - tcp::socket s(io_service); + tcp::socket s(io_context); asio::connect(s, endpoints); using namespace std; // For strlen. diff --git a/asio/src/examples/cpp03/echo/blocking_tcp_echo_server.cpp b/asio/src/examples/cpp03/echo/blocking_tcp_echo_server.cpp index 7e6e058f..6dd2f490 100644 --- a/asio/src/examples/cpp03/echo/blocking_tcp_echo_server.cpp +++ b/asio/src/examples/cpp03/echo/blocking_tcp_echo_server.cpp @@ -44,12 +44,12 @@ void session(socket_ptr sock) } } -void server(asio::io_service& io_service, unsigned short port) +void server(asio::io_context& io_context, unsigned short port) { - tcp::acceptor a(io_service, tcp::endpoint(tcp::v4(), port)); + tcp::acceptor a(io_context, tcp::endpoint(tcp::v4(), port)); for (;;) { - socket_ptr sock(new tcp::socket(io_service)); + socket_ptr sock(new tcp::socket(io_context)); a.accept(*sock); asio::thread t(boost::bind(session, sock)); } @@ -65,10 +65,10 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; using namespace std; // For atoi. - server(io_service, atoi(argv[1])); + server(io_context, atoi(argv[1])); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/echo/blocking_udp_echo_client.cpp b/asio/src/examples/cpp03/echo/blocking_udp_echo_client.cpp index f189ebcc..fb3601e7 100644 --- a/asio/src/examples/cpp03/echo/blocking_udp_echo_client.cpp +++ b/asio/src/examples/cpp03/echo/blocking_udp_echo_client.cpp @@ -27,11 +27,11 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; - udp::socket s(io_service, udp::endpoint(udp::v4(), 0)); + udp::socket s(io_context, udp::endpoint(udp::v4(), 0)); - udp::resolver resolver(io_service); + udp::resolver resolver(io_context); udp::resolver::results_type endpoints = resolver.resolve(udp::v4(), argv[1], argv[2]); diff --git a/asio/src/examples/cpp03/echo/blocking_udp_echo_server.cpp b/asio/src/examples/cpp03/echo/blocking_udp_echo_server.cpp index c3ab124a..f6b37d09 100644 --- a/asio/src/examples/cpp03/echo/blocking_udp_echo_server.cpp +++ b/asio/src/examples/cpp03/echo/blocking_udp_echo_server.cpp @@ -16,9 +16,9 @@ using asio::ip::udp; enum { max_length = 1024 }; -void server(asio::io_service& io_service, unsigned short port) +void server(asio::io_context& io_context, unsigned short port) { - udp::socket sock(io_service, udp::endpoint(udp::v4(), port)); + udp::socket sock(io_context, udp::endpoint(udp::v4(), port)); for (;;) { char data[max_length]; @@ -39,10 +39,10 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; using namespace std; // For atoi. - server(io_service, atoi(argv[1])); + server(io_context, atoi(argv[1])); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/fork/daemon.cpp b/asio/src/examples/cpp03/fork/daemon.cpp index 43ea1ced..e962548d 100644 --- a/asio/src/examples/cpp03/fork/daemon.cpp +++ b/asio/src/examples/cpp03/fork/daemon.cpp @@ -8,7 +8,7 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#include +#include #include #include #include @@ -23,8 +23,8 @@ using asio::ip::udp; class udp_daytime_server { public: - udp_daytime_server(asio::io_service& io_service) - : socket_(io_service, udp::endpoint(udp::v4(), 13)) + udp_daytime_server(asio::io_context& io_context) + : socket_(io_context, udp::endpoint(udp::v4(), 13)) { start_receive(); } @@ -62,24 +62,24 @@ int main() { try { - asio::io_service io_service; + asio::io_context io_context; // Initialise the server before becoming a daemon. If the process is // started from a shell, this means any errors will be reported back to the // user. - udp_daytime_server server(io_service); + udp_daytime_server server(io_context); // Register signal handlers so that the daemon may be shut down. You may // also want to register for other signals, such as SIGHUP to trigger a // re-read of a configuration file. - asio::signal_set signals(io_service, SIGINT, SIGTERM); + asio::signal_set signals(io_context, SIGINT, SIGTERM); signals.async_wait( - boost::bind(&asio::io_service::stop, &io_service)); + boost::bind(&asio::io_context::stop, &io_context)); - // Inform the io_service that we are about to become a daemon. The - // io_service cleans up any internal resources, such as threads, that may + // Inform the io_context that we are about to become a daemon. The + // io_context cleans up any internal resources, such as threads, that may // interfere with forking. - io_service.notify_fork(asio::io_service::fork_prepare); + io_context.notify_fork(asio::io_context::fork_prepare); // Fork the process and have the parent exit. If the process was started // from a shell, this returns control to the user. Forking a new process is @@ -92,15 +92,15 @@ int main() // // When the exit() function is used, the program terminates without // invoking local variables' destructors. Only global variables are - // destroyed. As the io_service object is a local variable, this means + // destroyed. As the io_context object is a local variable, this means // we do not have to call: // - // io_service.notify_fork(asio::io_service::fork_parent); + // io_context.notify_fork(asio::io_context::fork_parent); // // However, this line should be added before each call to exit() if - // using a global io_service object. An additional call: + // using a global io_context object. An additional call: // - // io_service.notify_fork(asio::io_service::fork_prepare); + // io_context.notify_fork(asio::io_context::fork_prepare); // // should also precede the second fork(). exit(0); @@ -171,14 +171,14 @@ int main() return 1; } - // Inform the io_service that we have finished becoming a daemon. The - // io_service uses this opportunity to create any internal file descriptors + // Inform the io_context that we have finished becoming a daemon. The + // io_context uses this opportunity to create any internal file descriptors // that need to be private to the new process. - io_service.notify_fork(asio::io_service::fork_child); + io_context.notify_fork(asio::io_context::fork_child); - // The io_service can now be used normally. + // The io_context can now be used normally. syslog(LOG_INFO | LOG_USER, "Daemon started"); - io_service.run(); + io_context.run(); syslog(LOG_INFO | LOG_USER, "Daemon stopped"); } catch (std::exception& e) diff --git a/asio/src/examples/cpp03/fork/process_per_connection.cpp b/asio/src/examples/cpp03/fork/process_per_connection.cpp index 9950565a..10963702 100644 --- a/asio/src/examples/cpp03/fork/process_per_connection.cpp +++ b/asio/src/examples/cpp03/fork/process_per_connection.cpp @@ -8,7 +8,7 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#include +#include #include #include #include @@ -25,11 +25,11 @@ using asio::ip::tcp; class server { public: - server(asio::io_service& io_service, unsigned short port) - : io_service_(io_service), - signal_(io_service, SIGCHLD), - acceptor_(io_service, tcp::endpoint(tcp::v4(), port)), - socket_(io_service) + server(asio::io_context& io_context, unsigned short port) + : io_context_(io_context), + signal_(io_context, SIGCHLD), + acceptor_(io_context, tcp::endpoint(tcp::v4(), port)), + socket_(io_context) { start_signal_wait(); start_accept(); @@ -65,17 +65,17 @@ private: { if (!ec) { - // Inform the io_service that we are about to fork. The io_service cleans + // Inform the io_context that we are about to fork. The io_context cleans // up any internal resources, such as threads, that may interfere with // forking. - io_service_.notify_fork(asio::io_service::fork_prepare); + io_context_.notify_fork(asio::io_context::fork_prepare); if (fork() == 0) { - // Inform the io_service that the fork is finished and that this is the - // child process. The io_service uses this opportunity to create any + // Inform the io_context that the fork is finished and that this is the + // child process. The io_context uses this opportunity to create any // internal file descriptors that must be private to the new process. - io_service_.notify_fork(asio::io_service::fork_child); + io_context_.notify_fork(asio::io_context::fork_child); // The child won't be accepting new connections, so we can close the // acceptor. It remains open in the parent. @@ -88,11 +88,11 @@ private: } else { - // Inform the io_service that the fork is finished (or failed) and that - // this is the parent process. The io_service uses this opportunity to + // Inform the io_context that the fork is finished (or failed) and that + // this is the parent process. The io_context uses this opportunity to // recreate any internal resources that were cleaned up during // preparation for the fork. - io_service_.notify_fork(asio::io_service::fork_parent); + io_context_.notify_fork(asio::io_context::fork_parent); socket_.close(); start_accept(); @@ -129,7 +129,7 @@ private: start_read(); } - asio::io_service& io_service_; + asio::io_context& io_context_; asio::signal_set signal_; tcp::acceptor acceptor_; tcp::socket socket_; @@ -146,12 +146,12 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; using namespace std; // For atoi. - server s(io_service, atoi(argv[1])); + server s(io_context, atoi(argv[1])); - io_service.run(); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/http/client/async_client.cpp b/asio/src/examples/cpp03/http/client/async_client.cpp index fa9b6257..97890bad 100644 --- a/asio/src/examples/cpp03/http/client/async_client.cpp +++ b/asio/src/examples/cpp03/http/client/async_client.cpp @@ -20,10 +20,10 @@ using asio::ip::tcp; class client { public: - client(asio::io_service& io_service, + client(asio::io_context& io_context, const std::string& server, const std::string& path) - : resolver_(io_service), - socket_(io_service) + : resolver_(io_context), + socket_(io_context) { // Form the request. We specify the "Connection: close" header so that the // server will close the socket after transmitting the response. This will @@ -191,9 +191,9 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; - client c(io_service, argv[1], argv[2]); - io_service.run(); + asio::io_context io_context; + client c(io_context, argv[1], argv[2]); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/http/client/sync_client.cpp b/asio/src/examples/cpp03/http/client/sync_client.cpp index d90f1f21..5505fcf8 100644 --- a/asio/src/examples/cpp03/http/client/sync_client.cpp +++ b/asio/src/examples/cpp03/http/client/sync_client.cpp @@ -28,14 +28,14 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; // Get a list of endpoints corresponding to the server name. - tcp::resolver resolver(io_service); + tcp::resolver resolver(io_context); tcp::resolver::results_type endpoints = resolver.resolve(argv[1], "http"); // Try each endpoint until we successfully establish a connection. - tcp::socket socket(io_service); + tcp::socket socket(io_context); asio::connect(socket, endpoints); // Form the request. We specify the "Connection: close" header so that the diff --git a/asio/src/examples/cpp03/http/server/connection.cpp b/asio/src/examples/cpp03/http/server/connection.cpp index 8133c3a1..ab4fedba 100644 --- a/asio/src/examples/cpp03/http/server/connection.cpp +++ b/asio/src/examples/cpp03/http/server/connection.cpp @@ -17,9 +17,9 @@ namespace http { namespace server { -connection::connection(asio::io_service& io_service, +connection::connection(asio::io_context& io_context, connection_manager& manager, request_handler& handler) - : socket_(io_service), + : socket_(io_context), connection_manager_(manager), request_handler_(handler) { diff --git a/asio/src/examples/cpp03/http/server/connection.hpp b/asio/src/examples/cpp03/http/server/connection.hpp index 5d99f1b6..ff4ec42b 100644 --- a/asio/src/examples/cpp03/http/server/connection.hpp +++ b/asio/src/examples/cpp03/http/server/connection.hpp @@ -32,8 +32,8 @@ class connection private boost::noncopyable { public: - /// Construct a connection with the given io_service. - explicit connection(asio::io_service& io_service, + /// Construct a connection with the given io_context. + explicit connection(asio::io_context& io_context, connection_manager& manager, request_handler& handler); /// Get the socket associated with the connection. diff --git a/asio/src/examples/cpp03/http/server/server.cpp b/asio/src/examples/cpp03/http/server/server.cpp index b534ea8d..c0028563 100644 --- a/asio/src/examples/cpp03/http/server/server.cpp +++ b/asio/src/examples/cpp03/http/server/server.cpp @@ -17,9 +17,9 @@ namespace server { server::server(const std::string& address, const std::string& port, const std::string& doc_root) - : io_service_(), - signals_(io_service_), - acceptor_(io_service_), + : io_context_(), + signals_(io_context_), + acceptor_(io_context_), connection_manager_(), new_connection_(), request_handler_(doc_root) @@ -35,7 +35,7 @@ server::server(const std::string& address, const std::string& port, signals_.async_wait(boost::bind(&server::handle_stop, this)); // Open the acceptor with the option to reuse the address (i.e. SO_REUSEADDR). - asio::ip::tcp::resolver resolver(io_service_); + asio::ip::tcp::resolver resolver(io_context_); asio::ip::tcp::endpoint endpoint = *resolver.resolve(address, port).begin(); acceptor_.open(endpoint.protocol()); @@ -48,16 +48,16 @@ server::server(const std::string& address, const std::string& port, void server::run() { - // The io_service::run() call will block until all asynchronous operations + // The io_context::run() call will block until all asynchronous operations // have finished. While the server is running, there is always at least one // asynchronous operation outstanding: the asynchronous accept call waiting // for new incoming connections. - io_service_.run(); + io_context_.run(); } void server::start_accept() { - new_connection_.reset(new connection(io_service_, + new_connection_.reset(new connection(io_context_, connection_manager_, request_handler_)); acceptor_.async_accept(new_connection_->socket(), boost::bind(&server::handle_accept, this, @@ -84,7 +84,7 @@ void server::handle_accept(const asio::error_code& e) void server::handle_stop() { // The server is stopped by cancelling all outstanding asynchronous - // operations. Once all operations have finished the io_service::run() call + // operations. Once all operations have finished the io_context::run() call // will exit. acceptor_.close(); connection_manager_.stop_all(); diff --git a/asio/src/examples/cpp03/http/server/server.hpp b/asio/src/examples/cpp03/http/server/server.hpp index e14707b7..6c0b6803 100644 --- a/asio/src/examples/cpp03/http/server/server.hpp +++ b/asio/src/examples/cpp03/http/server/server.hpp @@ -31,7 +31,7 @@ public: explicit server(const std::string& address, const std::string& port, const std::string& doc_root); - /// Run the server's io_service loop. + /// Run the server's io_context loop. void run(); private: @@ -44,8 +44,8 @@ private: /// Handle a request to stop the server. void handle_stop(); - /// The io_service used to perform asynchronous operations. - asio::io_service io_service_; + /// The io_context used to perform asynchronous operations. + asio::io_context io_context_; /// The signal_set is used to register for process termination notifications. asio::signal_set signals_; diff --git a/asio/src/examples/cpp03/http/server2/connection.cpp b/asio/src/examples/cpp03/http/server2/connection.cpp index 7b54909b..51bf004c 100644 --- a/asio/src/examples/cpp03/http/server2/connection.cpp +++ b/asio/src/examples/cpp03/http/server2/connection.cpp @@ -16,9 +16,9 @@ namespace http { namespace server2 { -connection::connection(asio::io_service& io_service, +connection::connection(asio::io_context& io_context, request_handler& handler) - : socket_(io_service), + : socket_(io_context), request_handler_(handler) { } diff --git a/asio/src/examples/cpp03/http/server2/connection.hpp b/asio/src/examples/cpp03/http/server2/connection.hpp index 2b5d37b6..149a1ff8 100644 --- a/asio/src/examples/cpp03/http/server2/connection.hpp +++ b/asio/src/examples/cpp03/http/server2/connection.hpp @@ -30,8 +30,8 @@ class connection private boost::noncopyable { public: - /// Construct a connection with the given io_service. - explicit connection(asio::io_service& io_service, + /// Construct a connection with the given io_context. + explicit connection(asio::io_context& io_context, request_handler& handler); /// Get the socket associated with the connection. diff --git a/asio/src/examples/cpp03/http/server2/io_context_pool.cpp b/asio/src/examples/cpp03/http/server2/io_context_pool.cpp new file mode 100644 index 00000000..61d46e6d --- /dev/null +++ b/asio/src/examples/cpp03/http/server2/io_context_pool.cpp @@ -0,0 +1,70 @@ +// +// io_context_pool.cpp +// ~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#include "server.hpp" +#include +#include +#include + +namespace http { +namespace server2 { + +io_context_pool::io_context_pool(std::size_t pool_size) + : next_io_context_(0) +{ + if (pool_size == 0) + throw std::runtime_error("io_context_pool size is 0"); + + // Give all the io_contexts work to do so that their run() functions will not + // exit until they are explicitly stopped. + for (std::size_t i = 0; i < pool_size; ++i) + { + io_context_ptr io_context(new asio::io_context); + work_ptr work(new asio::io_context::work(*io_context)); + io_contexts_.push_back(io_context); + work_.push_back(work); + } +} + +void io_context_pool::run() +{ + // Create a pool of threads to run all of the io_contexts. + std::vector > threads; + for (std::size_t i = 0; i < io_contexts_.size(); ++i) + { + boost::shared_ptr thread(new asio::thread( + boost::bind(&asio::io_context::run, io_contexts_[i]))); + threads.push_back(thread); + } + + // Wait for all threads in the pool to exit. + for (std::size_t i = 0; i < threads.size(); ++i) + threads[i]->join(); +} + +void io_context_pool::stop() +{ + // Explicitly stop all io_contexts. + for (std::size_t i = 0; i < io_contexts_.size(); ++i) + io_contexts_[i]->stop(); +} + +asio::io_context& io_context_pool::get_io_context() +{ + // Use a round-robin scheme to choose the next io_context to use. + asio::io_context& io_context = *io_contexts_[next_io_context_]; + ++next_io_context_; + if (next_io_context_ == io_contexts_.size()) + next_io_context_ = 0; + return io_context; +} + +} // namespace server2 +} // namespace http diff --git a/asio/src/examples/cpp03/http/server2/io_service_pool.hpp b/asio/src/examples/cpp03/http/server2/io_context_pool.hpp similarity index 51% rename from asio/src/examples/cpp03/http/server2/io_service_pool.hpp rename to asio/src/examples/cpp03/http/server2/io_context_pool.hpp index f4178fe8..300b6752 100644 --- a/asio/src/examples/cpp03/http/server2/io_service_pool.hpp +++ b/asio/src/examples/cpp03/http/server2/io_context_pool.hpp @@ -1,5 +1,5 @@ // -// io_service_pool.hpp +// io_context_pool.hpp // ~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) @@ -19,35 +19,35 @@ namespace http { namespace server2 { -/// A pool of io_service objects. -class io_service_pool +/// A pool of io_context objects. +class io_context_pool : private boost::noncopyable { public: - /// Construct the io_service pool. - explicit io_service_pool(std::size_t pool_size); + /// Construct the io_context pool. + explicit io_context_pool(std::size_t pool_size); - /// Run all io_service objects in the pool. + /// Run all io_context objects in the pool. void run(); - /// Stop all io_service objects in the pool. + /// Stop all io_context objects in the pool. void stop(); - /// Get an io_service to use. - asio::io_service& get_io_service(); + /// Get an io_context to use. + asio::io_context& get_io_context(); private: - typedef boost::shared_ptr io_service_ptr; - typedef boost::shared_ptr work_ptr; + typedef boost::shared_ptr io_context_ptr; + typedef boost::shared_ptr work_ptr; - /// The pool of io_services. - std::vector io_services_; + /// The pool of io_contexts. + std::vector io_contexts_; - /// The work that keeps the io_services running. + /// The work that keeps the io_contexts running. std::vector work_; - /// The next io_service to use for a connection. - std::size_t next_io_service_; + /// The next io_context to use for a connection. + std::size_t next_io_context_; }; } // namespace server2 diff --git a/asio/src/examples/cpp03/http/server2/io_service_pool.cpp b/asio/src/examples/cpp03/http/server2/io_service_pool.cpp deleted file mode 100644 index 3ff41705..00000000 --- a/asio/src/examples/cpp03/http/server2/io_service_pool.cpp +++ /dev/null @@ -1,70 +0,0 @@ -// -// io_service_pool.cpp -// ~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#include "server.hpp" -#include -#include -#include - -namespace http { -namespace server2 { - -io_service_pool::io_service_pool(std::size_t pool_size) - : next_io_service_(0) -{ - if (pool_size == 0) - throw std::runtime_error("io_service_pool size is 0"); - - // Give all the io_services work to do so that their run() functions will not - // exit until they are explicitly stopped. - for (std::size_t i = 0; i < pool_size; ++i) - { - io_service_ptr io_service(new asio::io_service); - work_ptr work(new asio::io_service::work(*io_service)); - io_services_.push_back(io_service); - work_.push_back(work); - } -} - -void io_service_pool::run() -{ - // Create a pool of threads to run all of the io_services. - std::vector > threads; - for (std::size_t i = 0; i < io_services_.size(); ++i) - { - boost::shared_ptr thread(new asio::thread( - boost::bind(&asio::io_service::run, io_services_[i]))); - threads.push_back(thread); - } - - // Wait for all threads in the pool to exit. - for (std::size_t i = 0; i < threads.size(); ++i) - threads[i]->join(); -} - -void io_service_pool::stop() -{ - // Explicitly stop all io_services. - for (std::size_t i = 0; i < io_services_.size(); ++i) - io_services_[i]->stop(); -} - -asio::io_service& io_service_pool::get_io_service() -{ - // Use a round-robin scheme to choose the next io_service to use. - asio::io_service& io_service = *io_services_[next_io_service_]; - ++next_io_service_; - if (next_io_service_ == io_services_.size()) - next_io_service_ = 0; - return io_service; -} - -} // namespace server2 -} // namespace http diff --git a/asio/src/examples/cpp03/http/server2/server.cpp b/asio/src/examples/cpp03/http/server2/server.cpp index 4ba84dea..974a7465 100644 --- a/asio/src/examples/cpp03/http/server2/server.cpp +++ b/asio/src/examples/cpp03/http/server2/server.cpp @@ -15,10 +15,10 @@ namespace http { namespace server2 { server::server(const std::string& address, const std::string& port, - const std::string& doc_root, std::size_t io_service_pool_size) - : io_service_pool_(io_service_pool_size), - signals_(io_service_pool_.get_io_service()), - acceptor_(io_service_pool_.get_io_service()), + const std::string& doc_root, std::size_t io_context_pool_size) + : io_context_pool_(io_context_pool_size), + signals_(io_context_pool_.get_io_context()), + acceptor_(io_context_pool_.get_io_context()), new_connection_(), request_handler_(doc_root) { @@ -46,13 +46,13 @@ server::server(const std::string& address, const std::string& port, void server::run() { - io_service_pool_.run(); + io_context_pool_.run(); } void server::start_accept() { new_connection_.reset(new connection( - io_service_pool_.get_io_service(), request_handler_)); + io_context_pool_.get_io_context(), request_handler_)); acceptor_.async_accept(new_connection_->socket(), boost::bind(&server::handle_accept, this, asio::placeholders::error)); @@ -70,7 +70,7 @@ void server::handle_accept(const asio::error_code& e) void server::handle_stop() { - io_service_pool_.stop(); + io_context_pool_.stop(); } } // namespace server2 diff --git a/asio/src/examples/cpp03/http/server2/server.hpp b/asio/src/examples/cpp03/http/server2/server.hpp index 1c7c5c15..ca9fc03e 100644 --- a/asio/src/examples/cpp03/http/server2/server.hpp +++ b/asio/src/examples/cpp03/http/server2/server.hpp @@ -17,7 +17,7 @@ #include #include #include "connection.hpp" -#include "io_service_pool.hpp" +#include "io_context_pool.hpp" #include "request_handler.hpp" namespace http { @@ -31,9 +31,9 @@ public: /// Construct the server to listen on the specified TCP address and port, and /// serve up files from the given directory. explicit server(const std::string& address, const std::string& port, - const std::string& doc_root, std::size_t io_service_pool_size); + const std::string& doc_root, std::size_t io_context_pool_size); - /// Run the server's io_service loop. + /// Run the server's io_context loop. void run(); private: @@ -46,8 +46,8 @@ private: /// Handle a request to stop the server. void handle_stop(); - /// The pool of io_service objects used to perform asynchronous operations. - io_service_pool io_service_pool_; + /// The pool of io_context objects used to perform asynchronous operations. + io_context_pool io_context_pool_; /// The signal_set is used to register for process termination notifications. asio::signal_set signals_; diff --git a/asio/src/examples/cpp03/http/server3/connection.cpp b/asio/src/examples/cpp03/http/server3/connection.cpp index 2f301456..8b4d6e00 100644 --- a/asio/src/examples/cpp03/http/server3/connection.cpp +++ b/asio/src/examples/cpp03/http/server3/connection.cpp @@ -16,10 +16,10 @@ namespace http { namespace server3 { -connection::connection(asio::io_service& io_service, +connection::connection(asio::io_context& io_context, request_handler& handler) - : strand_(io_service), - socket_(io_service), + : strand_(io_context), + socket_(io_context), request_handler_(handler) { } diff --git a/asio/src/examples/cpp03/http/server3/connection.hpp b/asio/src/examples/cpp03/http/server3/connection.hpp index 2a6c2603..9be26975 100644 --- a/asio/src/examples/cpp03/http/server3/connection.hpp +++ b/asio/src/examples/cpp03/http/server3/connection.hpp @@ -30,8 +30,8 @@ class connection private boost::noncopyable { public: - /// Construct a connection with the given io_service. - explicit connection(asio::io_service& io_service, + /// Construct a connection with the given io_context. + explicit connection(asio::io_context& io_context, request_handler& handler); /// Get the socket associated with the connection. @@ -49,7 +49,7 @@ private: void handle_write(const asio::error_code& e); /// Strand to ensure the connection's handlers are not called concurrently. - asio::io_service::strand strand_; + asio::io_context::strand strand_; /// Socket for the connection. asio::ip::tcp::socket socket_; diff --git a/asio/src/examples/cpp03/http/server3/server.cpp b/asio/src/examples/cpp03/http/server3/server.cpp index e26711bf..4bfddc4b 100644 --- a/asio/src/examples/cpp03/http/server3/server.cpp +++ b/asio/src/examples/cpp03/http/server3/server.cpp @@ -19,8 +19,8 @@ namespace server3 { server::server(const std::string& address, const std::string& port, const std::string& doc_root, std::size_t thread_pool_size) : thread_pool_size_(thread_pool_size), - signals_(io_service_), - acceptor_(io_service_), + signals_(io_context_), + acceptor_(io_context_), new_connection_(), request_handler_(doc_root) { @@ -35,7 +35,7 @@ server::server(const std::string& address, const std::string& port, signals_.async_wait(boost::bind(&server::handle_stop, this)); // Open the acceptor with the option to reuse the address (i.e. SO_REUSEADDR). - asio::ip::tcp::resolver resolver(io_service_); + asio::ip::tcp::resolver resolver(io_context_); asio::ip::tcp::endpoint endpoint = *resolver.resolve(address, port).begin(); acceptor_.open(endpoint.protocol()); @@ -48,12 +48,12 @@ server::server(const std::string& address, const std::string& port, void server::run() { - // Create a pool of threads to run all of the io_services. + // Create a pool of threads to run all of the io_contexts. std::vector > threads; for (std::size_t i = 0; i < thread_pool_size_; ++i) { boost::shared_ptr thread(new asio::thread( - boost::bind(&asio::io_service::run, &io_service_))); + boost::bind(&asio::io_context::run, &io_context_))); threads.push_back(thread); } @@ -64,7 +64,7 @@ void server::run() void server::start_accept() { - new_connection_.reset(new connection(io_service_, request_handler_)); + new_connection_.reset(new connection(io_context_, request_handler_)); acceptor_.async_accept(new_connection_->socket(), boost::bind(&server::handle_accept, this, asio::placeholders::error)); @@ -82,7 +82,7 @@ void server::handle_accept(const asio::error_code& e) void server::handle_stop() { - io_service_.stop(); + io_context_.stop(); } } // namespace server3 diff --git a/asio/src/examples/cpp03/http/server3/server.hpp b/asio/src/examples/cpp03/http/server3/server.hpp index 5c4492d6..7ef3e7e8 100644 --- a/asio/src/examples/cpp03/http/server3/server.hpp +++ b/asio/src/examples/cpp03/http/server3/server.hpp @@ -32,7 +32,7 @@ public: explicit server(const std::string& address, const std::string& port, const std::string& doc_root, std::size_t thread_pool_size); - /// Run the server's io_service loop. + /// Run the server's io_context loop. void run(); private: @@ -45,11 +45,11 @@ private: /// Handle a request to stop the server. void handle_stop(); - /// The number of threads that will call io_service::run(). + /// The number of threads that will call io_context::run(). std::size_t thread_pool_size_; - /// The io_service used to perform asynchronous operations. - asio::io_service io_service_; + /// The io_context used to perform asynchronous operations. + asio::io_context io_context_; /// The signal_set is used to register for process termination notifications. asio::signal_set signals_; diff --git a/asio/src/examples/cpp03/http/server4/main.cpp b/asio/src/examples/cpp03/http/server4/main.cpp index 22361220..80ccffb8 100644 --- a/asio/src/examples/cpp03/http/server4/main.cpp +++ b/asio/src/examples/cpp03/http/server4/main.cpp @@ -30,24 +30,24 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; // Launch the initial server coroutine. - http::server4::server(io_service, argv[1], argv[2], + http::server4::server(io_context, argv[1], argv[2], http::server4::file_handler(argv[3]))(); // Wait for signals indicating time to shut down. - asio::signal_set signals(io_service); + asio::signal_set signals(io_context); signals.add(SIGINT); signals.add(SIGTERM); #if defined(SIGQUIT) signals.add(SIGQUIT); #endif // defined(SIGQUIT) signals.async_wait(boost::bind( - &asio::io_service::stop, &io_service)); + &asio::io_context::stop, &io_context)); // Run the server. - io_service.run(); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/http/server4/server.cpp b/asio/src/examples/cpp03/http/server4/server.cpp index ebb93452..bcb8219b 100644 --- a/asio/src/examples/cpp03/http/server4/server.cpp +++ b/asio/src/examples/cpp03/http/server4/server.cpp @@ -15,15 +15,15 @@ namespace http { namespace server4 { -server::server(asio::io_service& io_service, +server::server(asio::io_context& io_context, const std::string& address, const std::string& port, boost::function request_handler) : request_handler_(request_handler) { - tcp::resolver resolver(io_service); + tcp::resolver resolver(io_context); asio::ip::tcp::endpoint endpoint = *resolver.resolve(address, port).begin(); - acceptor_.reset(new tcp::acceptor(io_service, endpoint)); + acceptor_.reset(new tcp::acceptor(io_context, endpoint)); } // Enable the pseudo-keywords reenter, yield and fork. @@ -50,7 +50,7 @@ void server::operator()(asio::error_code ec, std::size_t length) // Accept a new connection. The "yield" pseudo-keyword saves the current // line number and exits the coroutine's "reenter" block. We use the // server coroutine as the completion handler for the async_accept - // operation. When the asynchronous operation completes, the io_service + // operation. When the asynchronous operation completes, the io_context // invokes the function call operator, we "reenter" the coroutine, and // then control resumes at the following line. yield acceptor_->async_accept(*socket_, *this); diff --git a/asio/src/examples/cpp03/http/server4/server.hpp b/asio/src/examples/cpp03/http/server4/server.hpp index 6ddefdb2..95aabe81 100644 --- a/asio/src/examples/cpp03/http/server4/server.hpp +++ b/asio/src/examples/cpp03/http/server4/server.hpp @@ -30,7 +30,7 @@ class server : asio::coroutine public: /// Construct the server to listen on the specified TCP address and port, and /// serve up files from the given directory. - explicit server(asio::io_service& io_service, + explicit server(asio::io_context& io_context, const std::string& address, const std::string& port, boost::function request_handler); diff --git a/asio/src/examples/cpp03/icmp/ping.cpp b/asio/src/examples/cpp03/icmp/ping.cpp index fdee6642..e3a1b674 100644 --- a/asio/src/examples/cpp03/icmp/ping.cpp +++ b/asio/src/examples/cpp03/icmp/ping.cpp @@ -24,9 +24,9 @@ namespace posix_time = boost::posix_time; class pinger { public: - pinger(asio::io_service& io_service, const char* destination) - : resolver_(io_service), socket_(io_service, icmp::v4()), - timer_(io_service), sequence_number_(0), num_replies_(0) + pinger(asio::io_context& io_context, const char* destination) + : resolver_(io_context), socket_(io_context, icmp::v4()), + timer_(io_context), sequence_number_(0), num_replies_(0) { destination_ = *resolver_.resolve(icmp::v4(), destination, "").begin(); @@ -150,9 +150,9 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; - pinger p(io_service, argv[1]); - io_service.run(); + asio::io_context io_context; + pinger p(io_context, argv[1]); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/invocation/prioritised_handlers.cpp b/asio/src/examples/cpp03/invocation/prioritised_handlers.cpp index a93537fd..aecc3bec 100644 --- a/asio/src/examples/cpp03/invocation/prioritised_handlers.cpp +++ b/asio/src/examples/cpp03/invocation/prioritised_handlers.cpp @@ -127,32 +127,32 @@ void low_priority_handler() int main() { - asio::io_service io_service; + asio::io_context io_context; handler_priority_queue pri_queue; // Post a completion handler to be run immediately. - asio::post(io_service, pri_queue.wrap(0, low_priority_handler)); + asio::post(io_context, pri_queue.wrap(0, low_priority_handler)); // Start an asynchronous accept that will complete immediately. tcp::endpoint endpoint(asio::ip::address_v4::loopback(), 0); - tcp::acceptor acceptor(io_service, endpoint); - tcp::socket server_socket(io_service); + tcp::acceptor acceptor(io_context, endpoint); + tcp::socket server_socket(io_context); acceptor.async_accept(server_socket, pri_queue.wrap(100, high_priority_handler)); - tcp::socket client_socket(io_service); + tcp::socket client_socket(io_context); client_socket.connect(acceptor.local_endpoint()); // Set a deadline timer to expire immediately. - asio::deadline_timer timer(io_service); + asio::deadline_timer timer(io_context); timer.expires_at(boost::posix_time::neg_infin); timer.async_wait(pri_queue.wrap(42, middle_priority_handler)); - while (io_service.run_one()) + while (io_context.run_one()) { // The custom invocation hook adds the handlers to the priority queue // rather than executing them from within the poll_one() call. - while (io_service.poll_one()) + while (io_context.poll_one()) ; pri_queue.execute_all(); diff --git a/asio/src/examples/cpp03/iostreams/daytime_server.cpp b/asio/src/examples/cpp03/iostreams/daytime_server.cpp index d71d97ef..6011f39d 100644 --- a/asio/src/examples/cpp03/iostreams/daytime_server.cpp +++ b/asio/src/examples/cpp03/iostreams/daytime_server.cpp @@ -26,10 +26,10 @@ int main() { try { - asio::io_service io_service; + asio::io_context io_context; tcp::endpoint endpoint(tcp::v4(), 13); - tcp::acceptor acceptor(io_service, endpoint); + tcp::acceptor acceptor(io_context, endpoint); for (;;) { diff --git a/asio/src/examples/cpp03/local/connect_pair.cpp b/asio/src/examples/cpp03/local/connect_pair.cpp index f3f27a3e..09b8e3bb 100644 --- a/asio/src/examples/cpp03/local/connect_pair.cpp +++ b/asio/src/examples/cpp03/local/connect_pair.cpp @@ -22,8 +22,8 @@ using asio::local::stream_protocol; class uppercase_filter { public: - uppercase_filter(asio::io_service& io_service) - : socket_(io_service) + uppercase_filter(asio::io_context& io_context) + : socket_(io_context) { } @@ -81,11 +81,11 @@ private: boost::array data_; }; -void run(asio::io_service* io_service) +void run(asio::io_context* io_context) { try { - io_service->run(); + io_context->run(); } catch (std::exception& e) { @@ -98,16 +98,16 @@ int main() { try { - asio::io_service io_service; + asio::io_context io_context; // Create filter and establish a connection to it. - uppercase_filter filter(io_service); - stream_protocol::socket socket(io_service); + uppercase_filter filter(io_context); + stream_protocol::socket socket(io_context); asio::local::connect_pair(socket, filter.socket()); filter.start(); - // The io_service runs in a background thread to perform filtering. - asio::thread thread(boost::bind(run, &io_service)); + // The io_context runs in a background thread to perform filtering. + asio::thread thread(boost::bind(run, &io_context)); for (;;) { diff --git a/asio/src/examples/cpp03/local/stream_client.cpp b/asio/src/examples/cpp03/local/stream_client.cpp index a0342b44..689a5f4c 100644 --- a/asio/src/examples/cpp03/local/stream_client.cpp +++ b/asio/src/examples/cpp03/local/stream_client.cpp @@ -29,9 +29,9 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; - stream_protocol::socket s(io_service); + stream_protocol::socket s(io_context); s.connect(stream_protocol::endpoint(argv[1])); using namespace std; // For strlen. diff --git a/asio/src/examples/cpp03/local/stream_server.cpp b/asio/src/examples/cpp03/local/stream_server.cpp index 2afe8c37..502bc0b2 100644 --- a/asio/src/examples/cpp03/local/stream_server.cpp +++ b/asio/src/examples/cpp03/local/stream_server.cpp @@ -24,8 +24,8 @@ class session : public boost::enable_shared_from_this { public: - session(asio::io_service& io_service) - : socket_(io_service) + session(asio::io_context& io_context) + : socket_(io_context) { } @@ -81,11 +81,11 @@ typedef boost::shared_ptr session_ptr; class server { public: - server(asio::io_service& io_service, const std::string& file) - : io_service_(io_service), - acceptor_(io_service, stream_protocol::endpoint(file)) + server(asio::io_context& io_context, const std::string& file) + : io_context_(io_context), + acceptor_(io_context, stream_protocol::endpoint(file)) { - session_ptr new_session(new session(io_service_)); + session_ptr new_session(new session(io_context_)); acceptor_.async_accept(new_session->socket(), boost::bind(&server::handle_accept, this, new_session, asio::placeholders::error)); @@ -99,14 +99,14 @@ public: new_session->start(); } - new_session.reset(new session(io_service_)); + new_session.reset(new session(io_context_)); acceptor_.async_accept(new_session->socket(), boost::bind(&server::handle_accept, this, new_session, asio::placeholders::error)); } private: - asio::io_service& io_service_; + asio::io_context& io_context_; stream_protocol::acceptor acceptor_; }; @@ -121,12 +121,12 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; std::remove(argv[1]); - server s(io_service, argv[1]); + server s(io_context, argv[1]); - io_service.run(); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/multicast/receiver.cpp b/asio/src/examples/cpp03/multicast/receiver.cpp index d9659719..77268784 100644 --- a/asio/src/examples/cpp03/multicast/receiver.cpp +++ b/asio/src/examples/cpp03/multicast/receiver.cpp @@ -18,10 +18,10 @@ const short multicast_port = 30001; class receiver { public: - receiver(asio::io_service& io_service, + receiver(asio::io_context& io_context, const asio::ip::address& listen_address, const asio::ip::address& multicast_address) - : socket_(io_service) + : socket_(io_context) { // Create the socket so that multiple may be bound to the same address. asio::ip::udp::endpoint listen_endpoint( @@ -78,11 +78,11 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; - receiver r(io_service, + asio::io_context io_context; + receiver r(io_context, asio::ip::make_address(argv[1]), asio::ip::make_address(argv[2])); - io_service.run(); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/multicast/sender.cpp b/asio/src/examples/cpp03/multicast/sender.cpp index e375ab1e..46b0d943 100644 --- a/asio/src/examples/cpp03/multicast/sender.cpp +++ b/asio/src/examples/cpp03/multicast/sender.cpp @@ -21,11 +21,11 @@ const int max_message_count = 10; class sender { public: - sender(asio::io_service& io_service, + sender(asio::io_context& io_context, const asio::ip::address& multicast_address) : endpoint_(multicast_address, multicast_port), - socket_(io_service, endpoint_.protocol()), - timer_(io_service), + socket_(io_context, endpoint_.protocol()), + timer_(io_context), message_count_(0) { std::ostringstream os; @@ -86,9 +86,9 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; - sender s(io_service, asio::ip::make_address(argv[1])); - io_service.run(); + asio::io_context io_context; + sender s(io_context, asio::ip::make_address(argv[1])); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/nonblocking/third_party_lib.cpp b/asio/src/examples/cpp03/nonblocking/third_party_lib.cpp index ecf7577f..aba111b3 100644 --- a/asio/src/examples/cpp03/nonblocking/third_party_lib.cpp +++ b/asio/src/examples/cpp03/nonblocking/third_party_lib.cpp @@ -83,9 +83,9 @@ class connection public: typedef boost::shared_ptr pointer; - static pointer create(asio::io_service& io_service) + static pointer create(asio::io_context& io_context) { - return pointer(new connection(io_service)); + return pointer(new connection(io_context)); } tcp::socket& socket() @@ -102,8 +102,8 @@ public: } private: - connection(asio::io_service& io_service) - : socket_(io_service), + connection(asio::io_context& io_context) + : socket_(io_context), session_impl_(socket_), read_in_progress_(false), write_in_progress_(false) @@ -183,8 +183,8 @@ private: class server { public: - server(asio::io_service& io_service, unsigned short port) - : acceptor_(io_service, tcp::endpoint(tcp::v4(), port)) + server(asio::io_context& io_context, unsigned short port) + : acceptor_(io_context, tcp::endpoint(tcp::v4(), port)) { start_accept(); } @@ -224,12 +224,12 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; using namespace std; // For atoi. - server s(io_service, atoi(argv[1])); + server s(io_context, atoi(argv[1])); - io_service.run(); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/porthopper/client.cpp b/asio/src/examples/cpp03/porthopper/client.cpp index a5952de9..ab4855c6 100644 --- a/asio/src/examples/cpp03/porthopper/client.cpp +++ b/asio/src/examples/cpp03/porthopper/client.cpp @@ -37,19 +37,19 @@ int main(int argc, char* argv[]) std::string host_name = argv[1]; std::string port = argv[2]; - asio::io_service io_service; + asio::io_context io_context; // Determine the location of the server. - tcp::resolver resolver(io_service); + tcp::resolver resolver(io_context); tcp::endpoint remote_endpoint = *resolver.resolve(host_name, port).begin(); // Establish the control connection to the server. - tcp::socket control_socket(io_service); + tcp::socket control_socket(io_context); control_socket.connect(remote_endpoint); // Create a datagram socket to receive data from the server. boost::shared_ptr data_socket( - new udp::socket(io_service, udp::endpoint(udp::v4(), 0))); + new udp::socket(io_context, udp::endpoint(udp::v4(), 0))); // Determine what port we will receive data on. udp::endpoint data_endpoint = data_socket->local_endpoint(); @@ -81,7 +81,7 @@ int main(int argc, char* argv[]) // Create the new data socket. boost::shared_ptr new_data_socket( - new udp::socket(io_service, udp::endpoint(udp::v4(), 0))); + new udp::socket(io_context, udp::endpoint(udp::v4(), 0))); // Determine the new port we will use to receive data. udp::endpoint new_data_endpoint = new_data_socket->local_endpoint(); @@ -125,7 +125,7 @@ int main(int argc, char* argv[]) // Even though we're performing a renegotation, we want to continue // receiving data as smoothly as possible. Therefore we will continue to // try to receive a frame from the server on the old data socket. If we - // receive a frame on this socket we will interrupt the io_service, + // receive a frame on this socket we will interrupt the io_context, // print the frame, and resume waiting for the other operations to // complete. frame f2; @@ -137,19 +137,19 @@ int main(int argc, char* argv[]) lambda::if_(!lambda::_1) [ // We have successfully received a frame on the old data - // socket. Stop the io_service so that we can print it. - lambda::bind(&asio::io_service::stop, &io_service), + // socket. Stop the io_context so that we can print it. + lambda::bind(&asio::io_context::stop, &io_context), lambda::var(done) = false ] )); } // Run the operations in parallel. This will block until all operations - // have finished, or until the io_service is interrupted. (No threads!) - io_service.restart(); - io_service.run(); + // have finished, or until the io_context is interrupted. (No threads!) + io_context.restart(); + io_context.run(); - // If the io_service.run() was interrupted then we have received a frame + // If the io_context.run() was interrupted then we have received a frame // on the old data socket. We need to keep waiting for the renegotation // operations to complete. if (!done) diff --git a/asio/src/examples/cpp03/porthopper/server.cpp b/asio/src/examples/cpp03/porthopper/server.cpp index 2e796969..dd703010 100644 --- a/asio/src/examples/cpp03/porthopper/server.cpp +++ b/asio/src/examples/cpp03/porthopper/server.cpp @@ -29,10 +29,10 @@ class server { public: // Construct the server to wait for incoming control connections. - server(asio::io_service& io_service, unsigned short port) - : acceptor_(io_service, tcp::endpoint(tcp::v4(), port)), - timer_(io_service), - udp_socket_(io_service, udp::endpoint(udp::v4(), 0)), + server(asio::io_context& io_context, unsigned short port) + : acceptor_(io_context, tcp::endpoint(tcp::v4(), port)), + timer_(io_context), + udp_socket_(io_context, udp::endpoint(udp::v4(), 0)), next_frame_number_(1) { // Start waiting for a new control connection. @@ -173,12 +173,12 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; using namespace std; // For atoi. - server s(io_service, atoi(argv[1])); + server s(io_context, atoi(argv[1])); - io_service.run(); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/serialization/client.cpp b/asio/src/examples/cpp03/serialization/client.cpp index b6c455f3..ebbe6379 100644 --- a/asio/src/examples/cpp03/serialization/client.cpp +++ b/asio/src/examples/cpp03/serialization/client.cpp @@ -23,12 +23,12 @@ class client { public: /// Constructor starts the asynchronous connect operation. - client(asio::io_service& io_service, + client(asio::io_context& io_context, const std::string& host, const std::string& service) - : connection_(io_service) + : connection_(io_context) { // Resolve the host name into an IP address. - asio::ip::tcp::resolver resolver(io_service); + asio::ip::tcp::resolver resolver(io_context); asio::ip::tcp::resolver::query query(host, service); asio::ip::tcp::resolver::iterator endpoint_iterator = resolver.resolve(query); @@ -54,7 +54,7 @@ public: else { // An error occurred. Log it and return. Since we are not starting a new - // operation the io_service will run out of work to do and the client will + // operation the io_context will run out of work to do and the client will // exit. std::cerr << e.message() << std::endl; } @@ -87,7 +87,7 @@ public: std::cerr << e.message() << std::endl; } - // Since we are not starting a new operation the io_service will run out of + // Since we are not starting a new operation the io_context will run out of // work to do and the client will exit. } @@ -112,9 +112,9 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; - s11n_example::client client(io_service, argv[1], argv[2]); - io_service.run(); + asio::io_context io_context; + s11n_example::client client(io_context, argv[1], argv[2]); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/serialization/connection.hpp b/asio/src/examples/cpp03/serialization/connection.hpp index 1f140733..d44aeac5 100644 --- a/asio/src/examples/cpp03/serialization/connection.hpp +++ b/asio/src/examples/cpp03/serialization/connection.hpp @@ -35,8 +35,8 @@ class connection { public: /// Constructor. - connection(asio::io_service& io_service) - : socket_(io_service) + connection(asio::io_context& io_context) + : socket_(io_context) { } @@ -65,7 +65,7 @@ public: { // Something went wrong, inform the caller. asio::error_code error(asio::error::invalid_argument); - socket_.get_io_service().post(boost::bind(handler, error)); + socket_.get_io_context().post(boost::bind(handler, error)); return; } outbound_header_ = header_stream.str(); diff --git a/asio/src/examples/cpp03/serialization/server.cpp b/asio/src/examples/cpp03/serialization/server.cpp index e6374603..c8d2000c 100644 --- a/asio/src/examples/cpp03/serialization/server.cpp +++ b/asio/src/examples/cpp03/serialization/server.cpp @@ -25,8 +25,8 @@ class server public: /// Constructor opens the acceptor and starts waiting for the first incoming /// connection. - server(asio::io_service& io_service, unsigned short port) - : acceptor_(io_service, + server(asio::io_context& io_context, unsigned short port) + : acceptor_(io_context, asio::ip::tcp::endpoint(asio::ip::tcp::v4(), port)) { // Create the data to be sent to each client. @@ -55,7 +55,7 @@ public: stocks_.push_back(s); // Start an accept operation for a new connection. - connection_ptr new_conn(new connection(acceptor_.get_io_service())); + connection_ptr new_conn(new connection(acceptor_.get_io_context())); acceptor_.async_accept(new_conn->socket(), boost::bind(&server::handle_accept, this, asio::placeholders::error, new_conn)); @@ -75,7 +75,7 @@ public: } // Start an accept operation for a new connection. - connection_ptr new_conn(new connection(acceptor_.get_io_service())); + connection_ptr new_conn(new connection(acceptor_.get_io_context())); acceptor_.async_accept(new_conn->socket(), boost::bind(&server::handle_accept, this, asio::placeholders::error, new_conn)); @@ -110,9 +110,9 @@ int main(int argc, char* argv[]) } unsigned short port = boost::lexical_cast(argv[1]); - asio::io_service io_service; - s11n_example::server server(io_service, port); - io_service.run(); + asio::io_context io_context; + s11n_example::server server(io_context, port); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/services/basic_logger.hpp b/asio/src/examples/cpp03/services/basic_logger.hpp index 9035dfe7..48711c24 100644 --- a/asio/src/examples/cpp03/services/basic_logger.hpp +++ b/asio/src/examples/cpp03/services/basic_logger.hpp @@ -34,13 +34,13 @@ public: /** * This constructor creates a logger. * - * @param io_service The io_service object used to locate the logger service. + * @param io_context The io_context object used to locate the logger service. * * @param identifier An identifier for this logger. */ - explicit basic_logger(asio::io_service& io_service, + explicit basic_logger(asio::io_context& io_context, const std::string& identifier) - : service_(asio::use_service(io_service)), + : service_(asio::use_service(io_context)), impl_(service_.null()) { service_.create(impl_, identifier); @@ -52,10 +52,10 @@ public: service_.destroy(impl_); } - /// Get the io_service associated with the object. - asio::io_service& get_io_service() + /// Get the io_context associated with the object. + asio::io_context& get_io_context() { - return service_.get_io_service(); + return service_.get_io_context(); } /// Set the output file for all logger instances. diff --git a/asio/src/examples/cpp03/services/daytime_client.cpp b/asio/src/examples/cpp03/services/daytime_client.cpp index 0d5c2499..88171420 100644 --- a/asio/src/examples/cpp03/services/daytime_client.cpp +++ b/asio/src/examples/cpp03/services/daytime_client.cpp @@ -56,25 +56,25 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; // Set the name of the file that all logger instances will use. - services::logger logger(io_service, ""); + services::logger logger(io_context, ""); logger.use_file("log.txt"); // Resolve the address corresponding to the given host. - asio::ip::tcp::resolver resolver(io_service); + asio::ip::tcp::resolver resolver(io_context); asio::ip::tcp::resolver::results_type endpoints = resolver.resolve(argv[1], "daytime"); // Start an asynchronous connect. - debug_stream_socket socket(io_service); + debug_stream_socket socket(io_context); asio::async_connect(socket, endpoints, boost::bind(connect_handler, asio::placeholders::error, &socket)); - // Run the io_service until all operations have finished. - io_service.run(); + // Run the io_context until all operations have finished. + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/services/logger_service.cpp b/asio/src/examples/cpp03/services/logger_service.cpp index 7138e715..fee47571 100644 --- a/asio/src/examples/cpp03/services/logger_service.cpp +++ b/asio/src/examples/cpp03/services/logger_service.cpp @@ -12,6 +12,6 @@ namespace services { -asio::io_service::id logger_service::id; +asio::io_context::id logger_service::id; } // namespace services diff --git a/asio/src/examples/cpp03/services/logger_service.hpp b/asio/src/examples/cpp03/services/logger_service.hpp index 1c04889e..8bee8ab7 100644 --- a/asio/src/examples/cpp03/services/logger_service.hpp +++ b/asio/src/examples/cpp03/services/logger_service.hpp @@ -24,11 +24,11 @@ namespace services { /// Service implementation for the logger. class logger_service - : public asio::io_service::service + : public asio::io_context::service { public: /// The unique service identifier. - static asio::io_service::id id; + static asio::io_context::id id; /// The backend implementation of a logger. struct logger_impl @@ -40,21 +40,21 @@ public: /// The type for an implementation of the logger. typedef logger_impl* impl_type; - /// Constructor creates a thread to run a private io_service. - logger_service(asio::io_service& io_service) - : asio::io_service::service(io_service), - work_io_service_(), - work_(new asio::io_service::work(work_io_service_)), + /// Constructor creates a thread to run a private io_context. + logger_service(asio::io_context& io_context) + : asio::io_context::service(io_context), + work_io_context_(), + work_(new asio::io_context::work(work_io_context_)), work_thread_(new asio::thread( - boost::bind(&asio::io_service::run, &work_io_service_))) + boost::bind(&asio::io_context::run, &work_io_context_))) { } - /// Destructor shuts down the private io_service. + /// Destructor shuts down the private io_context. ~logger_service() { - /// Indicate that we have finished with the private io_service. Its - /// io_service::run() function will exit once all other work has completed. + /// Indicate that we have finished with the private io_context. Its + /// io_context::run() function will exit once all other work has completed. work_.reset(); if (work_thread_) work_thread_->join(); @@ -91,7 +91,7 @@ public: void use_file(impl_type& /*impl*/, const std::string& file) { // Pass the work of opening the file to the background thread. - asio::post(work_io_service_, boost::bind( + asio::post(work_io_context_, boost::bind( &logger_service::use_file_impl, this, file)); } @@ -103,13 +103,13 @@ public: os << impl->identifier << ": " << message; // Pass the work of opening the file to the background thread. - asio::post(work_io_service_, boost::bind( + asio::post(work_io_context_, boost::bind( &logger_service::log_impl, this, os.str())); } private: /// Helper function used to open the output file from within the private - /// io_service's thread. + /// io_context's thread. void use_file_impl(const std::string& file) { ofstream_.close(); @@ -117,22 +117,22 @@ private: ofstream_.open(file.c_str()); } - /// Helper function used to log a message from within the private io_service's + /// Helper function used to log a message from within the private io_context's /// thread. void log_impl(const std::string& text) { ofstream_ << text << std::endl; } - /// Private io_service used for performing logging operations. - asio::io_service work_io_service_; + /// Private io_context used for performing logging operations. + asio::io_context work_io_context_; - /// Work for the private io_service to perform. If we do not give the - /// io_service some work to do then the io_service::run() function will exit + /// Work for the private io_context to perform. If we do not give the + /// io_context some work to do then the io_context::run() function will exit /// immediately. - boost::scoped_ptr work_; + boost::scoped_ptr work_; - /// Thread used for running the work io_service's run loop. + /// Thread used for running the work io_context's run loop. boost::scoped_ptr work_thread_; /// The file to which log messages will be written. diff --git a/asio/src/examples/cpp03/services/stream_socket_service.hpp b/asio/src/examples/cpp03/services/stream_socket_service.hpp index f99cc231..0e904beb 100644 --- a/asio/src/examples/cpp03/services/stream_socket_service.hpp +++ b/asio/src/examples/cpp03/services/stream_socket_service.hpp @@ -21,7 +21,7 @@ namespace services { /// Debugging stream socket service that wraps the normal stream socket service. template class stream_socket_service - : public asio::io_service::service + : public asio::io_context::service { private: /// The type of the wrapped stream socket service. @@ -29,7 +29,7 @@ private: public: /// The unique service identifier. - static asio::io_service::id id; + static asio::io_context::id id; /// The protocol type. typedef Protocol protocol_type; @@ -43,11 +43,11 @@ public: /// The native type of a stream socket. typedef typename service_impl_type::native_handle_type native_handle_type; - /// Construct a new stream socket service for the specified io_service. - explicit stream_socket_service(asio::io_service& io_service) - : asio::io_service::service(io_service), - service_impl_(asio::use_service(io_service)), - logger_(io_service, "stream_socket") + /// Construct a new stream socket service for the specified io_context. + explicit stream_socket_service(asio::io_context& io_context) + : asio::io_context::service(io_context), + service_impl_(asio::use_service(io_context)), + logger_(io_context, "stream_socket") { } @@ -344,7 +344,7 @@ private: }; template -asio::io_service::id stream_socket_service::id; +asio::io_context::id stream_socket_service::id; } // namespace services diff --git a/asio/src/examples/cpp03/socks4/sync_client.cpp b/asio/src/examples/cpp03/socks4/sync_client.cpp index 86dd3ab5..858263c3 100644 --- a/asio/src/examples/cpp03/socks4/sync_client.cpp +++ b/asio/src/examples/cpp03/socks4/sync_client.cpp @@ -31,15 +31,15 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; // Get a list of endpoints corresponding to the SOCKS 4 server name. - tcp::resolver resolver(io_service); + tcp::resolver resolver(io_context); tcp::resolver::results_type endpoints = resolver.resolve(argv[1], argv[2]); // Try each endpoint until we successfully establish a connection to the // SOCKS 4 server. - tcp::socket socket(io_service); + tcp::socket socket(io_context); asio::connect(socket, endpoints); // Get an endpoint for the Boost website. This will be passed to the SOCKS diff --git a/asio/src/examples/cpp03/spawn/echo_server.cpp b/asio/src/examples/cpp03/spawn/echo_server.cpp index 6c7dd634..3905c152 100644 --- a/asio/src/examples/cpp03/spawn/echo_server.cpp +++ b/asio/src/examples/cpp03/spawn/echo_server.cpp @@ -9,7 +9,7 @@ // #include -#include +#include #include #include #include @@ -23,10 +23,10 @@ using asio::ip::tcp; class session : public boost::enable_shared_from_this { public: - explicit session(asio::io_service& io_service) - : strand_(io_service), - socket_(io_service), - timer_(io_service) + explicit session(asio::io_context& io_context) + : strand_(io_context), + socket_(io_context), + timer_(io_context) { } @@ -76,20 +76,20 @@ private: } } - asio::io_service::strand strand_; + asio::io_context::strand strand_; tcp::socket socket_; asio::deadline_timer timer_; }; -void do_accept(asio::io_service& io_service, +void do_accept(asio::io_context& io_context, unsigned short port, asio::yield_context yield) { - tcp::acceptor acceptor(io_service, tcp::endpoint(tcp::v4(), port)); + tcp::acceptor acceptor(io_context, tcp::endpoint(tcp::v4(), port)); for (;;) { asio::error_code ec; - boost::shared_ptr new_session(new session(io_service)); + boost::shared_ptr new_session(new session(io_context)); acceptor.async_accept(new_session->socket(), yield[ec]); if (!ec) new_session->go(); } @@ -105,13 +105,13 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; - asio::spawn(io_service, + asio::spawn(io_context, boost::bind(do_accept, - boost::ref(io_service), atoi(argv[1]), _1)); + boost::ref(io_context), atoi(argv[1]), _1)); - io_service.run(); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/ssl/client.cpp b/asio/src/examples/cpp03/ssl/client.cpp index 037ee0d6..591c9a4e 100644 --- a/asio/src/examples/cpp03/ssl/client.cpp +++ b/asio/src/examples/cpp03/ssl/client.cpp @@ -19,10 +19,10 @@ enum { max_length = 1024 }; class client { public: - client(asio::io_service& io_service, + client(asio::io_context& io_context, asio::ssl::context& context, asio::ip::tcp::resolver::results_type endpoints) - : socket_(io_service, context) + : socket_(io_context, context) { socket_.set_verify_mode(asio::ssl::verify_peer); socket_.set_verify_callback( @@ -134,18 +134,18 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; - asio::ip::tcp::resolver resolver(io_service); + asio::ip::tcp::resolver resolver(io_context); asio::ip::tcp::resolver::results_type endpoints = resolver.resolve(argv[1], argv[2]); asio::ssl::context ctx(asio::ssl::context::sslv23); ctx.load_verify_file("ca.pem"); - client c(io_service, ctx, endpoints); + client c(io_context, ctx, endpoints); - io_service.run(); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/ssl/server.cpp b/asio/src/examples/cpp03/ssl/server.cpp index e67914e6..96ec4ad0 100644 --- a/asio/src/examples/cpp03/ssl/server.cpp +++ b/asio/src/examples/cpp03/ssl/server.cpp @@ -19,9 +19,9 @@ typedef asio::ssl::stream ssl_socket; class session { public: - session(asio::io_service& io_service, + session(asio::io_context& io_context, asio::ssl::context& context) - : socket_(io_service, context) + : socket_(io_context, context) { } @@ -92,9 +92,9 @@ private: class server { public: - server(asio::io_service& io_service, unsigned short port) - : io_service_(io_service), - acceptor_(io_service, + server(asio::io_context& io_context, unsigned short port) + : io_context_(io_context), + acceptor_(io_context, asio::ip::tcp::endpoint(asio::ip::tcp::v4(), port)), context_(asio::ssl::context::sslv23) { @@ -117,7 +117,7 @@ public: void start_accept() { - session* new_session = new session(io_service_, context_); + session* new_session = new session(io_context_, context_); acceptor_.async_accept(new_session->socket(), boost::bind(&server::handle_accept, this, new_session, asio::placeholders::error)); @@ -139,7 +139,7 @@ public: } private: - asio::io_service& io_service_; + asio::io_context& io_context_; asio::ip::tcp::acceptor acceptor_; asio::ssl::context context_; }; @@ -154,12 +154,12 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; using namespace std; // For atoi. - server s(io_service, atoi(argv[1])); + server s(io_context, atoi(argv[1])); - io_service.run(); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/timeouts/async_tcp_client.cpp b/asio/src/examples/cpp03/timeouts/async_tcp_client.cpp index 668d3e09..74dd239c 100644 --- a/asio/src/examples/cpp03/timeouts/async_tcp_client.cpp +++ b/asio/src/examples/cpp03/timeouts/async_tcp_client.cpp @@ -9,7 +9,7 @@ // #include "asio/deadline_timer.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/ip/tcp.hpp" #include "asio/read_until.hpp" #include "asio/streambuf.hpp" @@ -83,11 +83,11 @@ using asio::ip::tcp; class client { public: - client(asio::io_service& io_service) + client(asio::io_context& io_context) : stopped_(false), - socket_(io_service), - deadline_(io_service), - heartbeat_timer_(io_service) + socket_(io_context), + deadline_(io_context), + heartbeat_timer_(io_context) { } @@ -291,13 +291,13 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; - tcp::resolver r(io_service); - client c(io_service); + asio::io_context io_context; + tcp::resolver r(io_context); + client c(io_context); c.start(r.resolve(argv[1], argv[2])); - io_service.run(); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/timeouts/blocking_tcp_client.cpp b/asio/src/examples/cpp03/timeouts/blocking_tcp_client.cpp index 005a33f9..afd967e5 100644 --- a/asio/src/examples/cpp03/timeouts/blocking_tcp_client.cpp +++ b/asio/src/examples/cpp03/timeouts/blocking_tcp_client.cpp @@ -10,7 +10,7 @@ #include "asio/connect.hpp" #include "asio/deadline_timer.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/ip/tcp.hpp" #include "asio/read_until.hpp" #include "asio/streambuf.hpp" @@ -49,14 +49,14 @@ using boost::lambda::_1; // and any outstanding operations are consequently cancelled. The socket // operations themselves use boost::lambda function objects as completion // handlers. For a given socket operation, the client object runs the -// io_service to block thread execution until the actor completes. +// io_context to block thread execution until the actor completes. // class client { public: client() - : socket_(io_service_), - deadline_(io_service_) + : socket_(io_context_), + deadline_(io_context_) { // No deadline is required until the first socket operation is started. We // set the deadline to positive infinity so that the actor takes no action @@ -72,7 +72,7 @@ public: { // Resolve the host name and service to a list of endpoints. tcp::resolver::results_type endpoints = - tcp::resolver(io_service_).resolve(host, service); + tcp::resolver(io_context_).resolve(host, service); // Set a deadline for the asynchronous operation. As a host name may // resolve to multiple endpoints, this function uses the composed operation @@ -94,7 +94,7 @@ public: asio::async_connect(socket_, endpoints, var(ec) = _1); // Block until the asynchronous operation has completed. - do io_service_.run_one(); while (ec == asio::error::would_block); + do io_context_.run_one(); while (ec == asio::error::would_block); // Determine whether a connection was successfully established. The // deadline actor may have had a chance to run and close our socket, even @@ -127,7 +127,7 @@ public: asio::async_read_until(socket_, input_buffer_, '\n', var(ec) = _1); // Block until the asynchronous operation has completed. - do io_service_.run_one(); while (ec == asio::error::would_block); + do io_context_.run_one(); while (ec == asio::error::would_block); if (ec) throw asio::system_error(ec); @@ -162,7 +162,7 @@ public: asio::async_write(socket_, asio::buffer(data), var(ec) = _1); // Block until the asynchronous operation has completed. - do io_service_.run_one(); while (ec == asio::error::would_block); + do io_context_.run_one(); while (ec == asio::error::would_block); if (ec) throw asio::system_error(ec); @@ -191,7 +191,7 @@ private: deadline_.async_wait(bind(&client::check_deadline, this)); } - asio::io_service io_service_; + asio::io_context io_context_; tcp::socket socket_; deadline_timer deadline_; asio::streambuf input_buffer_; diff --git a/asio/src/examples/cpp03/timeouts/blocking_udp_client.cpp b/asio/src/examples/cpp03/timeouts/blocking_udp_client.cpp index 325b503a..e3ecd8de 100644 --- a/asio/src/examples/cpp03/timeouts/blocking_udp_client.cpp +++ b/asio/src/examples/cpp03/timeouts/blocking_udp_client.cpp @@ -9,7 +9,7 @@ // #include "asio/deadline_timer.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/ip/udp.hpp" #include #include @@ -51,15 +51,15 @@ using asio::ip::udp; // | | // +----------------+ // -// The client object runs the io_service to block thread execution until the +// The client object runs the io_context to block thread execution until the // actor completes. // class client { public: client(const udp::endpoint& listen_endpoint) - : socket_(io_service_, listen_endpoint), - deadline_(io_service_) + : socket_(io_context_, listen_endpoint), + deadline_(io_context_) { // No deadline is required until the first socket operation is started. We // set the deadline to positive infinity so that the actor takes no action @@ -90,7 +90,7 @@ public: boost::bind(&client::handle_receive, _1, _2, &ec, &length)); // Block until the asynchronous operation has completed. - do io_service_.run_one(); while (ec == asio::error::would_block); + do io_context_.run_one(); while (ec == asio::error::would_block); return length; } @@ -129,7 +129,7 @@ private: } private: - asio::io_service io_service_; + asio::io_context io_context_; udp::socket socket_; deadline_timer deadline_; }; diff --git a/asio/src/examples/cpp03/timeouts/server.cpp b/asio/src/examples/cpp03/timeouts/server.cpp index 486aecd7..8c1ee09c 100644 --- a/asio/src/examples/cpp03/timeouts/server.cpp +++ b/asio/src/examples/cpp03/timeouts/server.cpp @@ -17,7 +17,7 @@ #include #include #include "asio/deadline_timer.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/ip/tcp.hpp" #include "asio/ip/udp.hpp" #include "asio/read_until.hpp" @@ -133,12 +133,12 @@ class tcp_session public boost::enable_shared_from_this { public: - tcp_session(asio::io_service& io_service, channel& ch) + tcp_session(asio::io_context& io_context, channel& ch) : channel_(ch), - socket_(io_service), - input_deadline_(io_service), - non_empty_output_queue_(io_service), - output_deadline_(io_service) + socket_(io_context), + input_deadline_(io_context), + non_empty_output_queue_(io_context), + output_deadline_(io_context) { input_deadline_.expires_at(boost::posix_time::pos_infin); output_deadline_.expires_at(boost::posix_time::pos_infin); @@ -334,9 +334,9 @@ class udp_broadcaster : public subscriber { public: - udp_broadcaster(asio::io_service& io_service, + udp_broadcaster(asio::io_context& io_context, const udp::endpoint& broadcast_endpoint) - : socket_(io_service) + : socket_(io_context) { socket_.connect(broadcast_endpoint); } @@ -356,13 +356,13 @@ private: class server { public: - server(asio::io_service& io_service, + server(asio::io_context& io_context, const tcp::endpoint& listen_endpoint, const udp::endpoint& broadcast_endpoint) - : io_service_(io_service), - acceptor_(io_service, listen_endpoint) + : io_context_(io_context), + acceptor_(io_context, listen_endpoint) { - subscriber_ptr bc(new udp_broadcaster(io_service_, broadcast_endpoint)); + subscriber_ptr bc(new udp_broadcaster(io_context_, broadcast_endpoint)); channel_.join(bc); start_accept(); @@ -370,7 +370,7 @@ public: void start_accept() { - tcp_session_ptr new_session(new tcp_session(io_service_, channel_)); + tcp_session_ptr new_session(new tcp_session(io_context_, channel_)); acceptor_.async_accept(new_session->socket(), boost::bind(&server::handle_accept, this, new_session, _1)); @@ -388,7 +388,7 @@ public: } private: - asio::io_service& io_service_; + asio::io_context& io_context_; tcp::acceptor acceptor_; channel channel_; }; @@ -407,16 +407,16 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; tcp::endpoint listen_endpoint(tcp::v4(), atoi(argv[1])); udp::endpoint broadcast_endpoint( asio::ip::make_address(argv[2]), atoi(argv[3])); - server s(io_service, listen_endpoint, broadcast_endpoint); + server s(io_context, listen_endpoint, broadcast_endpoint); - io_service.run(); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/timers/tick_count_timer.cpp b/asio/src/examples/cpp03/timers/tick_count_timer.cpp index 816cfabc..16767e5f 100644 --- a/asio/src/examples/cpp03/timers/tick_count_timer.cpp +++ b/asio/src/examples/cpp03/timers/tick_count_timer.cpp @@ -101,9 +101,9 @@ int main() { try { - asio::io_service io_service; + asio::io_context io_context; - tick_count_timer timer(io_service, 5000); + tick_count_timer timer(io_context, 5000); std::cout << "Starting synchronous wait\n"; timer.wait(); std::cout << "Finished synchronous wait\n"; @@ -111,7 +111,7 @@ int main() timer.expires_from_now(5000); std::cout << "Starting asynchronous wait\n"; timer.async_wait(&handle_timeout); - io_service.run(); + io_context.run(); std::cout << "Finished asynchronous wait\n"; } catch (std::exception& e) diff --git a/asio/src/examples/cpp03/timers/time_t_timer.cpp b/asio/src/examples/cpp03/timers/time_t_timer.cpp index f188a2b7..345b4855 100644 --- a/asio/src/examples/cpp03/timers/time_t_timer.cpp +++ b/asio/src/examples/cpp03/timers/time_t_timer.cpp @@ -69,9 +69,9 @@ int main() { try { - asio::io_service io_service; + asio::io_context io_context; - time_t_timer timer(io_service); + time_t_timer timer(io_context); timer.expires_from_now(5); std::cout << "Starting synchronous wait\n"; @@ -81,7 +81,7 @@ int main() timer.expires_from_now(5); std::cout << "Starting asynchronous wait\n"; timer.async_wait(&handle_timeout); - io_service.run(); + io_context.run(); std::cout << "Finished asynchronous wait\n"; } catch (std::exception& e) diff --git a/asio/src/examples/cpp03/tutorial/daytime1/client.cpp b/asio/src/examples/cpp03/tutorial/daytime1/client.cpp index 4ab212ce..838cf4c5 100644 --- a/asio/src/examples/cpp03/tutorial/daytime1/client.cpp +++ b/asio/src/examples/cpp03/tutorial/daytime1/client.cpp @@ -24,13 +24,13 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; - tcp::resolver resolver(io_service); + tcp::resolver resolver(io_context); tcp::resolver::results_type endpoints = resolver.resolve(argv[1], "daytime"); - tcp::socket socket(io_service); + tcp::socket socket(io_context); asio::connect(socket, endpoints); for (;;) diff --git a/asio/src/examples/cpp03/tutorial/daytime2/server.cpp b/asio/src/examples/cpp03/tutorial/daytime2/server.cpp index 00d87495..fb2fa967 100644 --- a/asio/src/examples/cpp03/tutorial/daytime2/server.cpp +++ b/asio/src/examples/cpp03/tutorial/daytime2/server.cpp @@ -26,13 +26,13 @@ int main() { try { - asio::io_service io_service; + asio::io_context io_context; - tcp::acceptor acceptor(io_service, tcp::endpoint(tcp::v4(), 13)); + tcp::acceptor acceptor(io_context, tcp::endpoint(tcp::v4(), 13)); for (;;) { - tcp::socket socket(io_service); + tcp::socket socket(io_context); acceptor.accept(socket); std::string message = make_daytime_string(); diff --git a/asio/src/examples/cpp03/tutorial/daytime3/server.cpp b/asio/src/examples/cpp03/tutorial/daytime3/server.cpp index 86cbfdc4..77638324 100644 --- a/asio/src/examples/cpp03/tutorial/daytime3/server.cpp +++ b/asio/src/examples/cpp03/tutorial/daytime3/server.cpp @@ -31,9 +31,9 @@ class tcp_connection public: typedef boost::shared_ptr pointer; - static pointer create(asio::io_service& io_service) + static pointer create(asio::io_context& io_context) { - return pointer(new tcp_connection(io_service)); + return pointer(new tcp_connection(io_context)); } tcp::socket& socket() @@ -52,8 +52,8 @@ public: } private: - tcp_connection(asio::io_service& io_service) - : socket_(io_service) + tcp_connection(asio::io_context& io_context) + : socket_(io_context) { } @@ -69,8 +69,8 @@ private: class tcp_server { public: - tcp_server(asio::io_service& io_service) - : acceptor_(io_service, tcp::endpoint(tcp::v4(), 13)) + tcp_server(asio::io_context& io_context) + : acceptor_(io_context, tcp::endpoint(tcp::v4(), 13)) { start_accept(); } @@ -104,9 +104,9 @@ int main() { try { - asio::io_service io_service; - tcp_server server(io_service); - io_service.run(); + asio::io_context io_context; + tcp_server server(io_context); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/tutorial/daytime4/client.cpp b/asio/src/examples/cpp03/tutorial/daytime4/client.cpp index a9063829..74777235 100644 --- a/asio/src/examples/cpp03/tutorial/daytime4/client.cpp +++ b/asio/src/examples/cpp03/tutorial/daytime4/client.cpp @@ -24,13 +24,13 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; - udp::resolver resolver(io_service); + udp::resolver resolver(io_context); udp::endpoint receiver_endpoint = *resolver.resolve(udp::v4(), argv[1], "daytime").begin(); - udp::socket socket(io_service); + udp::socket socket(io_context); socket.open(udp::v4()); boost::array send_buf = {{ 0 }}; diff --git a/asio/src/examples/cpp03/tutorial/daytime5/server.cpp b/asio/src/examples/cpp03/tutorial/daytime5/server.cpp index 5de4b26c..e4d95f28 100644 --- a/asio/src/examples/cpp03/tutorial/daytime5/server.cpp +++ b/asio/src/examples/cpp03/tutorial/daytime5/server.cpp @@ -27,9 +27,9 @@ int main() { try { - asio::io_service io_service; + asio::io_context io_context; - udp::socket socket(io_service, udp::endpoint(udp::v4(), 13)); + udp::socket socket(io_context, udp::endpoint(udp::v4(), 13)); for (;;) { diff --git a/asio/src/examples/cpp03/tutorial/daytime6/server.cpp b/asio/src/examples/cpp03/tutorial/daytime6/server.cpp index 797dffe1..932968b9 100644 --- a/asio/src/examples/cpp03/tutorial/daytime6/server.cpp +++ b/asio/src/examples/cpp03/tutorial/daytime6/server.cpp @@ -28,8 +28,8 @@ std::string make_daytime_string() class udp_server { public: - udp_server(asio::io_service& io_service) - : socket_(io_service, udp::endpoint(udp::v4(), 13)) + udp_server(asio::io_context& io_context) + : socket_(io_context, udp::endpoint(udp::v4(), 13)) { start_receive(); } @@ -76,9 +76,9 @@ int main() { try { - asio::io_service io_service; - udp_server server(io_service); - io_service.run(); + asio::io_context io_context; + udp_server server(io_context); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/tutorial/daytime7/server.cpp b/asio/src/examples/cpp03/tutorial/daytime7/server.cpp index 2aa769c7..36c74d5a 100644 --- a/asio/src/examples/cpp03/tutorial/daytime7/server.cpp +++ b/asio/src/examples/cpp03/tutorial/daytime7/server.cpp @@ -33,9 +33,9 @@ class tcp_connection public: typedef boost::shared_ptr pointer; - static pointer create(asio::io_service& io_service) + static pointer create(asio::io_context& io_context) { - return pointer(new tcp_connection(io_service)); + return pointer(new tcp_connection(io_context)); } tcp::socket& socket() @@ -52,8 +52,8 @@ public: } private: - tcp_connection(asio::io_service& io_service) - : socket_(io_service) + tcp_connection(asio::io_context& io_context) + : socket_(io_context) { } @@ -68,8 +68,8 @@ private: class tcp_server { public: - tcp_server(asio::io_service& io_service) - : acceptor_(io_service, tcp::endpoint(tcp::v4(), 13)) + tcp_server(asio::io_context& io_context) + : acceptor_(io_context, tcp::endpoint(tcp::v4(), 13)) { start_accept(); } @@ -102,8 +102,8 @@ private: class udp_server { public: - udp_server(asio::io_service& io_service) - : socket_(io_service, udp::endpoint(udp::v4(), 13)) + udp_server(asio::io_context& io_context) + : socket_(io_context, udp::endpoint(udp::v4(), 13)) { start_receive(); } @@ -144,10 +144,10 @@ int main() { try { - asio::io_service io_service; - tcp_server server1(io_service); - udp_server server2(io_service); - io_service.run(); + asio::io_context io_context; + tcp_server server1(io_context); + udp_server server2(io_context); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp03/tutorial/timer1/timer.cpp b/asio/src/examples/cpp03/tutorial/timer1/timer.cpp index d72ac278..1f6156f1 100644 --- a/asio/src/examples/cpp03/tutorial/timer1/timer.cpp +++ b/asio/src/examples/cpp03/tutorial/timer1/timer.cpp @@ -14,7 +14,7 @@ int main() { - asio::io_service io; + asio::io_context io; asio::deadline_timer t(io, boost::posix_time::seconds(5)); t.wait(); diff --git a/asio/src/examples/cpp03/tutorial/timer2/timer.cpp b/asio/src/examples/cpp03/tutorial/timer2/timer.cpp index a2f3d9d3..3f84a68e 100644 --- a/asio/src/examples/cpp03/tutorial/timer2/timer.cpp +++ b/asio/src/examples/cpp03/tutorial/timer2/timer.cpp @@ -19,7 +19,7 @@ void print(const asio::error_code& /*e*/) int main() { - asio::io_service io; + asio::io_context io; asio::deadline_timer t(io, boost::posix_time::seconds(5)); t.async_wait(&print); diff --git a/asio/src/examples/cpp03/tutorial/timer3/timer.cpp b/asio/src/examples/cpp03/tutorial/timer3/timer.cpp index 314cdf51..07bff185 100644 --- a/asio/src/examples/cpp03/tutorial/timer3/timer.cpp +++ b/asio/src/examples/cpp03/tutorial/timer3/timer.cpp @@ -29,7 +29,7 @@ void print(const asio::error_code& /*e*/, int main() { - asio::io_service io; + asio::io_context io; int count = 0; asio::deadline_timer t(io, boost::posix_time::seconds(1)); diff --git a/asio/src/examples/cpp03/tutorial/timer4/timer.cpp b/asio/src/examples/cpp03/tutorial/timer4/timer.cpp index 60797d76..beedbf10 100644 --- a/asio/src/examples/cpp03/tutorial/timer4/timer.cpp +++ b/asio/src/examples/cpp03/tutorial/timer4/timer.cpp @@ -16,7 +16,7 @@ class printer { public: - printer(asio::io_service& io) + printer(asio::io_context& io) : timer_(io, boost::posix_time::seconds(1)), count_(0) { @@ -47,7 +47,7 @@ private: int main() { - asio::io_service io; + asio::io_context io; printer p(io); io.run(); diff --git a/asio/src/examples/cpp03/tutorial/timer5/timer.cpp b/asio/src/examples/cpp03/tutorial/timer5/timer.cpp index 5906748b..4c763dc2 100644 --- a/asio/src/examples/cpp03/tutorial/timer5/timer.cpp +++ b/asio/src/examples/cpp03/tutorial/timer5/timer.cpp @@ -16,7 +16,7 @@ class printer { public: - printer(asio::io_service& io) + printer(asio::io_context& io) : strand_(io), timer1_(io, boost::posix_time::seconds(1)), timer2_(io, boost::posix_time::seconds(1)), @@ -63,7 +63,7 @@ public: } private: - asio::io_service::strand strand_; + asio::io_context::strand strand_; asio::deadline_timer timer1_; asio::deadline_timer timer2_; int count_; @@ -71,9 +71,9 @@ private: int main() { - asio::io_service io; + asio::io_context io; printer p(io); - asio::thread t(boost::bind(&asio::io_service::run, &io)); + asio::thread t(boost::bind(&asio::io_context::run, &io)); io.run(); t.join(); diff --git a/asio/src/examples/cpp03/windows/transmit_file.cpp b/asio/src/examples/cpp03/windows/transmit_file.cpp index 20adfb3f..9ea28538 100644 --- a/asio/src/examples/cpp03/windows/transmit_file.cpp +++ b/asio/src/examples/cpp03/windows/transmit_file.cpp @@ -28,7 +28,7 @@ void transmit_file(tcp::socket& socket, random_access_handle& file, Handler handler) { // Construct an OVERLAPPED-derived object to contain the handler. - overlapped_ptr overlapped(socket.get_io_service(), handler); + overlapped_ptr overlapped(socket.get_io_context(), handler); // Initiate the TransmitFile operation. BOOL ok = ::TransmitFile(socket.native_handle(), @@ -40,7 +40,7 @@ void transmit_file(tcp::socket& socket, { // The operation completed immediately, so a completion notification needs // to be posted. When complete() is called, ownership of the OVERLAPPED- - // derived object passes to the io_service. + // derived object passes to the io_context. asio::error_code ec(last_error, asio::error::get_system_category()); overlapped.complete(ec, 0); @@ -48,7 +48,7 @@ void transmit_file(tcp::socket& socket, else { // The operation was successfully initiated, so ownership of the - // OVERLAPPED-derived object has passed to the io_service. + // OVERLAPPED-derived object has passed to the io_context. overlapped.release(); } } @@ -59,10 +59,10 @@ class connection public: typedef boost::shared_ptr pointer; - static pointer create(asio::io_service& io_service, + static pointer create(asio::io_context& io_context, const std::string& filename) { - return pointer(new connection(io_service, filename)); + return pointer(new connection(io_context, filename)); } tcp::socket& socket() @@ -85,10 +85,10 @@ public: } private: - connection(asio::io_service& io_service, const std::string& filename) - : socket_(io_service), + connection(asio::io_context& io_context, const std::string& filename) + : socket_(io_context), filename_(filename), - file_(io_service) + file_(io_context) { } @@ -107,9 +107,9 @@ private: class server { public: - server(asio::io_service& io_service, + server(asio::io_context& io_context, unsigned short port, const std::string& filename) - : acceptor_(io_service, tcp::endpoint(tcp::v4(), port)), + : acceptor_(io_context, tcp::endpoint(tcp::v4(), port)), filename_(filename) { start_accept(); @@ -119,7 +119,7 @@ private: void start_accept() { connection::pointer new_connection = - connection::create(acceptor_.get_io_service(), filename_); + connection::create(acceptor_.get_io_context(), filename_); acceptor_.async_accept(new_connection->socket(), boost::bind(&server::handle_accept, this, new_connection, @@ -151,12 +151,12 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; using namespace std; // For atoi. - server s(io_service, atoi(argv[1]), argv[2]); + server s(io_context, atoi(argv[1]), argv[2]); - io_service.run(); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp11/allocation/server.cpp b/asio/src/examples/cpp11/allocation/server.cpp index 18f58b8e..b8eb6625 100644 --- a/asio/src/examples/cpp11/allocation/server.cpp +++ b/asio/src/examples/cpp11/allocation/server.cpp @@ -166,8 +166,8 @@ private: class server { public: - server(asio::io_service& io_service, short port) - : acceptor_(io_service, tcp::endpoint(tcp::v4(), port)) + server(asio::io_context& io_context, short port) + : acceptor_(io_context, tcp::endpoint(tcp::v4(), port)) { do_accept(); } @@ -200,9 +200,9 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; - server s(io_service, std::atoi(argv[1])); - io_service.run(); + asio::io_context io_context; + server s(io_context, std::atoi(argv[1])); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp11/buffers/reference_counted.cpp b/asio/src/examples/cpp11/buffers/reference_counted.cpp index 32c0d8a7..df6c0edc 100644 --- a/asio/src/examples/cpp11/buffers/reference_counted.cpp +++ b/asio/src/examples/cpp11/buffers/reference_counted.cpp @@ -72,8 +72,8 @@ private: class server { public: - server(asio::io_service& io_service, short port) - : acceptor_(io_service, tcp::endpoint(tcp::v4(), port)) + server(asio::io_context& io_context, short port) + : acceptor_(io_context, tcp::endpoint(tcp::v4(), port)) { do_accept(); } @@ -106,11 +106,11 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; - server s(io_service, std::atoi(argv[1])); + server s(io_context, std::atoi(argv[1])); - io_service.run(); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp11/chat/chat_client.cpp b/asio/src/examples/cpp11/chat/chat_client.cpp index bfc37e32..045175c8 100644 --- a/asio/src/examples/cpp11/chat/chat_client.cpp +++ b/asio/src/examples/cpp11/chat/chat_client.cpp @@ -22,17 +22,17 @@ typedef std::deque chat_message_queue; class chat_client { public: - chat_client(asio::io_service& io_service, + chat_client(asio::io_context& io_context, const tcp::resolver::results_type& endpoints) - : io_service_(io_service), - socket_(io_service) + : io_context_(io_context), + socket_(io_context) { do_connect(endpoints); } void write(const chat_message& msg) { - asio::post(io_service_, + asio::post(io_context_, [this, msg]() { bool write_in_progress = !write_msgs_.empty(); @@ -46,7 +46,7 @@ public: void close() { - asio::post(io_service_, [this]() { socket_.close(); }); + asio::post(io_context_, [this]() { socket_.close(); }); } private: @@ -121,7 +121,7 @@ private: } private: - asio::io_service& io_service_; + asio::io_context& io_context_; tcp::socket socket_; chat_message read_msg_; chat_message_queue write_msgs_; @@ -137,13 +137,13 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; - tcp::resolver resolver(io_service); + tcp::resolver resolver(io_context); auto endpoints = resolver.resolve(argv[1], argv[2]); - chat_client c(io_service, endpoints); + chat_client c(io_context, endpoints); - std::thread t([&io_service](){ io_service.run(); }); + std::thread t([&io_context](){ io_context.run(); }); char line[chat_message::max_body_length + 1]; while (std::cin.getline(line, chat_message::max_body_length + 1)) diff --git a/asio/src/examples/cpp11/chat/chat_server.cpp b/asio/src/examples/cpp11/chat/chat_server.cpp index d118576c..8b5af409 100644 --- a/asio/src/examples/cpp11/chat/chat_server.cpp +++ b/asio/src/examples/cpp11/chat/chat_server.cpp @@ -169,9 +169,9 @@ private: class chat_server { public: - chat_server(asio::io_service& io_service, + chat_server(asio::io_context& io_context, const tcp::endpoint& endpoint) - : acceptor_(io_service, endpoint) + : acceptor_(io_context, endpoint) { do_accept(); } @@ -207,16 +207,16 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; std::list servers; for (int i = 1; i < argc; ++i) { tcp::endpoint endpoint(tcp::v4(), std::atoi(argv[i])); - servers.emplace_back(io_service, endpoint); + servers.emplace_back(io_context, endpoint); } - io_service.run(); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp11/echo/async_tcp_echo_server.cpp b/asio/src/examples/cpp11/echo/async_tcp_echo_server.cpp index 7c9a2cb1..fd08f542 100644 --- a/asio/src/examples/cpp11/echo/async_tcp_echo_server.cpp +++ b/asio/src/examples/cpp11/echo/async_tcp_echo_server.cpp @@ -65,8 +65,8 @@ private: class server { public: - server(asio::io_service& io_service, short port) - : acceptor_(io_service, tcp::endpoint(tcp::v4(), port)) + server(asio::io_context& io_context, short port) + : acceptor_(io_context, tcp::endpoint(tcp::v4(), port)) { do_accept(); } @@ -99,11 +99,11 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; - server s(io_service, std::atoi(argv[1])); + server s(io_context, std::atoi(argv[1])); - io_service.run(); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp11/echo/async_udp_echo_server.cpp b/asio/src/examples/cpp11/echo/async_udp_echo_server.cpp index efb6d6cd..44e9bbc9 100644 --- a/asio/src/examples/cpp11/echo/async_udp_echo_server.cpp +++ b/asio/src/examples/cpp11/echo/async_udp_echo_server.cpp @@ -17,8 +17,8 @@ using asio::ip::udp; class server { public: - server(asio::io_service& io_service, short port) - : socket_(io_service, udp::endpoint(udp::v4(), port)) + server(asio::io_context& io_context, short port) + : socket_(io_context, udp::endpoint(udp::v4(), port)) { do_receive(); } @@ -67,11 +67,11 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; - server s(io_service, std::atoi(argv[1])); + server s(io_context, std::atoi(argv[1])); - io_service.run(); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp11/echo/blocking_tcp_echo_client.cpp b/asio/src/examples/cpp11/echo/blocking_tcp_echo_client.cpp index cdcd3b55..57a9e9c2 100644 --- a/asio/src/examples/cpp11/echo/blocking_tcp_echo_client.cpp +++ b/asio/src/examples/cpp11/echo/blocking_tcp_echo_client.cpp @@ -27,10 +27,10 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; - tcp::socket s(io_service); - tcp::resolver resolver(io_service); + tcp::socket s(io_context); + tcp::resolver resolver(io_context); asio::connect(s, resolver.resolve(argv[1], argv[2])); std::cout << "Enter message: "; diff --git a/asio/src/examples/cpp11/echo/blocking_tcp_echo_server.cpp b/asio/src/examples/cpp11/echo/blocking_tcp_echo_server.cpp index 2fff5bfc..ba63cdf5 100644 --- a/asio/src/examples/cpp11/echo/blocking_tcp_echo_server.cpp +++ b/asio/src/examples/cpp11/echo/blocking_tcp_echo_server.cpp @@ -42,9 +42,9 @@ void session(tcp::socket sock) } } -void server(asio::io_service& io_service, unsigned short port) +void server(asio::io_context& io_context, unsigned short port) { - tcp::acceptor a(io_service, tcp::endpoint(tcp::v4(), port)); + tcp::acceptor a(io_context, tcp::endpoint(tcp::v4(), port)); for (;;) { std::thread(session, a.accept()).detach(); @@ -61,9 +61,9 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; - server(io_service, std::atoi(argv[1])); + server(io_context, std::atoi(argv[1])); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp11/echo/blocking_udp_echo_client.cpp b/asio/src/examples/cpp11/echo/blocking_udp_echo_client.cpp index 136ca340..0cb431c7 100644 --- a/asio/src/examples/cpp11/echo/blocking_udp_echo_client.cpp +++ b/asio/src/examples/cpp11/echo/blocking_udp_echo_client.cpp @@ -27,11 +27,11 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; - udp::socket s(io_service, udp::endpoint(udp::v4(), 0)); + udp::socket s(io_context, udp::endpoint(udp::v4(), 0)); - udp::resolver resolver(io_service); + udp::resolver resolver(io_context); udp::resolver::results_type endpoints = resolver.resolve(udp::v4(), argv[1], argv[2]); diff --git a/asio/src/examples/cpp11/echo/blocking_udp_echo_server.cpp b/asio/src/examples/cpp11/echo/blocking_udp_echo_server.cpp index 2f7a8166..35488d5c 100644 --- a/asio/src/examples/cpp11/echo/blocking_udp_echo_server.cpp +++ b/asio/src/examples/cpp11/echo/blocking_udp_echo_server.cpp @@ -16,9 +16,9 @@ using asio::ip::udp; enum { max_length = 1024 }; -void server(asio::io_service& io_service, unsigned short port) +void server(asio::io_context& io_context, unsigned short port) { - udp::socket sock(io_service, udp::endpoint(udp::v4(), port)); + udp::socket sock(io_context, udp::endpoint(udp::v4(), port)); for (;;) { char data[max_length]; @@ -39,9 +39,9 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; - server(io_service, std::atoi(argv[1])); + server(io_context, std::atoi(argv[1])); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp11/futures/daytime_client.cpp b/asio/src/examples/cpp11/futures/daytime_client.cpp index 6a1ecd38..321d2121 100644 --- a/asio/src/examples/cpp11/futures/daytime_client.cpp +++ b/asio/src/examples/cpp11/futures/daytime_client.cpp @@ -12,17 +12,17 @@ #include #include #include -#include +#include #include #include using asio::ip::udp; -void get_daytime(asio::io_service& io_service, const char* hostname) +void get_daytime(asio::io_context& io_context, const char* hostname) { try { - udp::resolver resolver(io_service); + udp::resolver resolver(io_context); std::future endpoints = resolver.async_resolve( @@ -32,7 +32,7 @@ void get_daytime(asio::io_service& io_service, const char* hostname) // The async_resolve operation above returns the endpoints as a future // value that is not retrieved ... - udp::socket socket(io_service, udp::v4()); + udp::socket socket(io_context, udp::v4()); std::array send_buf = {{ 0 }}; std::future send_length = @@ -74,15 +74,15 @@ int main(int argc, char* argv[]) return 1; } - // We run the io_service off in its own thread so that it operates + // We run the io_context off in its own thread so that it operates // completely asynchronously with respect to the rest of the program. - asio::io_service io_service; - asio::io_service::work work(io_service); - std::thread thread([&io_service](){ io_service.run(); }); + asio::io_context io_context; + asio::io_context::work work(io_context); + std::thread thread([&io_context](){ io_context.run(); }); - get_daytime(io_service, argv[1]); + get_daytime(io_context, argv[1]); - io_service.stop(); + io_context.stop(); thread.join(); } catch (std::exception& e) diff --git a/asio/src/examples/cpp11/http/server/server.cpp b/asio/src/examples/cpp11/http/server/server.cpp index 5a9a415c..705c6d66 100644 --- a/asio/src/examples/cpp11/http/server/server.cpp +++ b/asio/src/examples/cpp11/http/server/server.cpp @@ -17,9 +17,9 @@ namespace server { server::server(const std::string& address, const std::string& port, const std::string& doc_root) - : io_service_(), - signals_(io_service_), - acceptor_(io_service_), + : io_context_(), + signals_(io_context_), + acceptor_(io_context_), connection_manager_(), request_handler_(doc_root) { @@ -35,7 +35,7 @@ server::server(const std::string& address, const std::string& port, do_await_stop(); // Open the acceptor with the option to reuse the address (i.e. SO_REUSEADDR). - asio::ip::tcp::resolver resolver(io_service_); + asio::ip::tcp::resolver resolver(io_context_); asio::ip::tcp::endpoint endpoint = *resolver.resolve(address, port).begin(); acceptor_.open(endpoint.protocol()); @@ -48,11 +48,11 @@ server::server(const std::string& address, const std::string& port, void server::run() { - // The io_service::run() call will block until all asynchronous operations + // The io_context::run() call will block until all asynchronous operations // have finished. While the server is running, there is always at least one // asynchronous operation outstanding: the asynchronous accept call waiting // for new incoming connections. - io_service_.run(); + io_context_.run(); } void server::do_accept() @@ -83,7 +83,7 @@ void server::do_await_stop() [this](std::error_code /*ec*/, int /*signo*/) { // The server is stopped by cancelling all outstanding asynchronous - // operations. Once all operations have finished the io_service::run() + // operations. Once all operations have finished the io_context::run() // call will exit. acceptor_.close(); connection_manager_.stop_all(); diff --git a/asio/src/examples/cpp11/http/server/server.hpp b/asio/src/examples/cpp11/http/server/server.hpp index 88b8d75d..01bde8c6 100644 --- a/asio/src/examples/cpp11/http/server/server.hpp +++ b/asio/src/examples/cpp11/http/server/server.hpp @@ -32,7 +32,7 @@ public: explicit server(const std::string& address, const std::string& port, const std::string& doc_root); - /// Run the server's io_service loop. + /// Run the server's io_context loop. void run(); private: @@ -42,8 +42,8 @@ private: /// Wait for a request to stop the server. void do_await_stop(); - /// The io_service used to perform asynchronous operations. - asio::io_service io_service_; + /// The io_context used to perform asynchronous operations. + asio::io_context io_context_; /// The signal_set is used to register for process termination notifications. asio::signal_set signals_; diff --git a/asio/src/examples/cpp11/spawn/echo_server.cpp b/asio/src/examples/cpp11/spawn/echo_server.cpp index 4bd1f469..772eb83a 100644 --- a/asio/src/examples/cpp11/spawn/echo_server.cpp +++ b/asio/src/examples/cpp11/spawn/echo_server.cpp @@ -8,7 +8,7 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#include +#include #include #include #include @@ -23,8 +23,8 @@ class session : public std::enable_shared_from_this public: explicit session(tcp::socket socket) : socket_(std::move(socket)), - timer_(socket_.get_io_service()), - strand_(socket_.get_io_service()) + timer_(socket_.get_io_context()), + strand_(socket_.get_io_context()) { } @@ -67,7 +67,7 @@ public: private: tcp::socket socket_; asio::steady_timer timer_; - asio::io_service::strand strand_; + asio::io_context::strand strand_; }; int main(int argc, char* argv[]) @@ -80,24 +80,24 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; - asio::spawn(io_service, + asio::spawn(io_context, [&](asio::yield_context yield) { - tcp::acceptor acceptor(io_service, + tcp::acceptor acceptor(io_context, tcp::endpoint(tcp::v4(), std::atoi(argv[1]))); for (;;) { asio::error_code ec; - tcp::socket socket(io_service); + tcp::socket socket(io_context); acceptor.async_accept(socket, yield[ec]); if (!ec) std::make_shared(std::move(socket))->go(); } }); - io_service.run(); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp14/echo/async_tcp_echo_server.cpp b/asio/src/examples/cpp14/echo/async_tcp_echo_server.cpp index 7d335158..532ff20b 100644 --- a/asio/src/examples/cpp14/echo/async_tcp_echo_server.cpp +++ b/asio/src/examples/cpp14/echo/async_tcp_echo_server.cpp @@ -66,9 +66,9 @@ private: class server { public: - server(asio::io_service& io_service, short port) - : acceptor_(io_service, tcp::endpoint(tcp::v4(), port)), - socket_(io_service) + server(asio::io_context& io_context, short port) + : acceptor_(io_context, tcp::endpoint(tcp::v4(), port)), + socket_(io_context) { do_accept(); } @@ -102,11 +102,11 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; - server s(io_service, std::atoi(argv[1])); + server s(io_context, std::atoi(argv[1])); - io_service.run(); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp14/echo/async_udp_echo_server.cpp b/asio/src/examples/cpp14/echo/async_udp_echo_server.cpp index f0459cc3..1861374d 100644 --- a/asio/src/examples/cpp14/echo/async_udp_echo_server.cpp +++ b/asio/src/examples/cpp14/echo/async_udp_echo_server.cpp @@ -18,8 +18,8 @@ using asio::ip::udp; class server { public: - server(asio::io_service& io_service, short port) - : socket_(io_service, udp::endpoint(udp::v4(), port)) + server(asio::io_context& io_context, short port) + : socket_(io_context, udp::endpoint(udp::v4(), port)) { do_receive(); } @@ -68,11 +68,11 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; - server s(io_service, std::atoi(argv[1])); + server s(io_context, std::atoi(argv[1])); - io_service.run(); + io_context.run(); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp14/echo/blocking_tcp_echo_client.cpp b/asio/src/examples/cpp14/echo/blocking_tcp_echo_client.cpp index cdcd3b55..57a9e9c2 100644 --- a/asio/src/examples/cpp14/echo/blocking_tcp_echo_client.cpp +++ b/asio/src/examples/cpp14/echo/blocking_tcp_echo_client.cpp @@ -27,10 +27,10 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; - tcp::socket s(io_service); - tcp::resolver resolver(io_service); + tcp::socket s(io_context); + tcp::resolver resolver(io_context); asio::connect(s, resolver.resolve(argv[1], argv[2])); std::cout << "Enter message: "; diff --git a/asio/src/examples/cpp14/echo/blocking_tcp_echo_server.cpp b/asio/src/examples/cpp14/echo/blocking_tcp_echo_server.cpp index e78b4fee..aba13b0d 100644 --- a/asio/src/examples/cpp14/echo/blocking_tcp_echo_server.cpp +++ b/asio/src/examples/cpp14/echo/blocking_tcp_echo_server.cpp @@ -43,12 +43,12 @@ void session(tcp::socket sock) } } -void server(asio::io_service& io_service, unsigned short port) +void server(asio::io_context& io_context, unsigned short port) { - tcp::acceptor a(io_service, tcp::endpoint(tcp::v4(), port)); + tcp::acceptor a(io_context, tcp::endpoint(tcp::v4(), port)); for (;;) { - tcp::socket sock(io_service); + tcp::socket sock(io_context); a.accept(sock); std::thread(session, std::move(sock)).detach(); } @@ -64,9 +64,9 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; - server(io_service, std::atoi(argv[1])); + server(io_context, std::atoi(argv[1])); } catch (std::exception& e) { diff --git a/asio/src/examples/cpp14/echo/blocking_udp_echo_client.cpp b/asio/src/examples/cpp14/echo/blocking_udp_echo_client.cpp index 678099ef..01f61205 100644 --- a/asio/src/examples/cpp14/echo/blocking_udp_echo_client.cpp +++ b/asio/src/examples/cpp14/echo/blocking_udp_echo_client.cpp @@ -28,11 +28,11 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; - udp::socket s(io_service, udp::endpoint(udp::v4(), 0)); + udp::socket s(io_context, udp::endpoint(udp::v4(), 0)); - udp::resolver resolver(io_service); + udp::resolver resolver(io_context); udp::endpoint endpoint = *resolver.resolve(udp::v4(), argv[1], argv[2]).begin(); diff --git a/asio/src/examples/cpp14/echo/blocking_udp_echo_server.cpp b/asio/src/examples/cpp14/echo/blocking_udp_echo_server.cpp index 842c51a0..1f4b9488 100644 --- a/asio/src/examples/cpp14/echo/blocking_udp_echo_server.cpp +++ b/asio/src/examples/cpp14/echo/blocking_udp_echo_server.cpp @@ -17,9 +17,9 @@ using asio::ip::udp; enum { max_length = 1024 }; -void server(asio::io_service& io_service, unsigned short port) +void server(asio::io_context& io_context, unsigned short port) { - udp::socket sock(io_service, udp::endpoint(udp::v4(), port)); + udp::socket sock(io_context, udp::endpoint(udp::v4(), port)); for (;;) { char data[max_length]; @@ -40,9 +40,9 @@ int main(int argc, char* argv[]) return 1; } - asio::io_service io_service; + asio::io_context io_context; - server(io_service, std::atoi(argv[1])); + server(io_context, std::atoi(argv[1])); } catch (std::exception& e) { diff --git a/asio/src/tests/Makefile.am b/asio/src/tests/Makefile.am index 1c3a7f5a..8e93cab5 100644 --- a/asio/src/tests/Makefile.am +++ b/asio/src/tests/Makefile.am @@ -38,7 +38,7 @@ check_PROGRAMS = \ unit/generic/seq_packet_protocol \ unit/generic/stream_protocol \ unit/high_resolution_timer \ - unit/io_service \ + unit/io_context \ unit/ip/address \ unit/ip/address_v4 \ unit/ip/address_v4_iterator \ @@ -151,7 +151,7 @@ TESTS = \ unit/deadline_timer \ unit/error \ unit/high_resolution_timer \ - unit/io_service \ + unit/io_context \ unit/ip/address \ unit/ip/address_v4 \ unit/ip/address_v4_iterator \ @@ -277,7 +277,7 @@ unit_generic_raw_protocol_SOURCES = unit/generic/raw_protocol.cpp unit_generic_seq_packet_protocol_SOURCES = unit/generic/seq_packet_protocol.cpp unit_generic_stream_protocol_SOURCES = unit/generic/stream_protocol.cpp unit_high_resolution_timer_SOURCES = unit/high_resolution_timer.cpp -unit_io_service_SOURCES = unit/io_service.cpp +unit_io_context_SOURCES = unit/io_context.cpp unit_ip_address_SOURCES = unit/ip/address.cpp unit_ip_address_v4_SOURCES = unit/ip/address_v4.cpp unit_ip_address_v4_iterator_SOURCES = unit/ip/address_v4_iterator.cpp diff --git a/asio/src/tests/latency/tcp_client.cpp b/asio/src/tests/latency/tcp_client.cpp index 567b866f..0f63b3c3 100644 --- a/asio/src/tests/latency/tcp_client.cpp +++ b/asio/src/tests/latency/tcp_client.cpp @@ -50,12 +50,12 @@ int main(int argc, char* argv[]) std::size_t buf_size = static_cast(std::atoi(argv[4])); bool spin = (std::strcmp(argv[5], "spin") == 0); - asio::io_service io_service; + asio::io_context io_context; std::vector > sockets; for (int i = 0; i < num_connections; ++i) { - boost::shared_ptr s(new tcp::socket(io_service)); + boost::shared_ptr s(new tcp::socket(io_context)); tcp::endpoint target(asio::ip::make_address(ip), port); s->connect(target); diff --git a/asio/src/tests/latency/tcp_server.cpp b/asio/src/tests/latency/tcp_server.cpp index d613265d..77dc9ee1 100644 --- a/asio/src/tests/latency/tcp_server.cpp +++ b/asio/src/tests/latency/tcp_server.cpp @@ -8,7 +8,7 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#include +#include #include #include #include @@ -96,8 +96,8 @@ int main(int argc, char* argv[]) std::size_t buf_size = std::atoi(argv[3]); bool spin = (std::strcmp(argv[4], "spin") == 0); - asio::io_service io_service(1); - tcp::acceptor acceptor(io_service, tcp::endpoint(tcp::v4(), port)); + asio::io_context io_context(1); + tcp::acceptor acceptor(io_context, tcp::endpoint(tcp::v4(), port)); std::vector > servers; for (int i = 0; i < max_connections; ++i) @@ -108,7 +108,7 @@ int main(int argc, char* argv[]) } if (spin) - for (;;) io_service.poll(); + for (;;) io_context.poll(); else - io_service.run(); + io_context.run(); } diff --git a/asio/src/tests/latency/udp_client.cpp b/asio/src/tests/latency/udp_client.cpp index 19049767..5f3e5889 100644 --- a/asio/src/tests/latency/udp_client.cpp +++ b/asio/src/tests/latency/udp_client.cpp @@ -39,9 +39,9 @@ int main(int argc, char* argv[]) std::size_t buf_size = static_cast(std::atoi(argv[4])); bool spin = (std::strcmp(argv[5], "spin") == 0); - asio::io_service io_service; + asio::io_context io_context; - udp::socket socket(io_service, udp::endpoint(udp::v4(), 0)); + udp::socket socket(io_context, udp::endpoint(udp::v4(), 0)); if (spin) { diff --git a/asio/src/tests/latency/udp_server.cpp b/asio/src/tests/latency/udp_server.cpp index 1b9b6c28..6aa2f8a4 100644 --- a/asio/src/tests/latency/udp_server.cpp +++ b/asio/src/tests/latency/udp_server.cpp @@ -8,7 +8,7 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#include +#include #include #include #include @@ -24,9 +24,9 @@ using asio::ip::udp; class udp_server : coroutine { public: - udp_server(asio::io_service& io_service, + udp_server(asio::io_context& io_context, unsigned short port, std::size_t buf_size) : - socket_(io_service, udp::endpoint(udp::v4(), port)), + socket_(io_context, udp::endpoint(udp::v4(), port)), buffer_(buf_size) { } @@ -107,19 +107,19 @@ int main(int argc, char* argv[]) std::size_t buf_size = std::atoi(argv[3]); bool spin = (std::strcmp(argv[4], "spin") == 0); - asio::io_service io_service(1); + asio::io_context io_context(1); std::vector > servers; for (unsigned short i = 0; i < num_ports; ++i) { unsigned short port = first_port + i; - boost::shared_ptr s(new udp_server(io_service, port, buf_size)); + boost::shared_ptr s(new udp_server(io_context, port, buf_size)); servers.push_back(s); (*s)(asio::error_code()); } if (spin) - for (;;) io_service.poll(); + for (;;) io_context.poll(); else - io_service.run(); + io_context.run(); } diff --git a/asio/src/tests/performance/client.cpp b/asio/src/tests/performance/client.cpp index dfd71dc4..972379a5 100644 --- a/asio/src/tests/performance/client.cpp +++ b/asio/src/tests/performance/client.cpp @@ -50,9 +50,9 @@ private: class session { public: - session(asio::io_service& ios, size_t block_size, stats& s) - : strand_(ios), - socket_(ios), + session(asio::io_context& ioc, size_t block_size, stats& s) + : strand_(ioc), + socket_(ioc), block_size_(block_size), read_data_(new char[block_size]), read_data_length_(0), @@ -173,7 +173,7 @@ private: } private: - asio::io_service::strand strand_; + asio::io_context::strand strand_; asio::ip::tcp::socket socket_; size_t block_size_; char* read_data_; @@ -190,11 +190,11 @@ private: class client { public: - client(asio::io_service& ios, + client(asio::io_context& ioc, const asio::ip::tcp::resolver::results_type endpoints, size_t block_size, size_t session_count, int timeout) - : io_service_(ios), - stop_timer_(ios), + : io_context_(ioc), + stop_timer_(ioc), sessions_(), stats_() { @@ -203,7 +203,7 @@ public: for (size_t i = 0; i < session_count; ++i) { - session* new_session = new session(io_service_, block_size, stats_); + session* new_session = new session(io_context_, block_size, stats_); new_session->start(endpoints); sessions_.push_back(new_session); } @@ -227,7 +227,7 @@ public: } private: - asio::io_service& io_service_; + asio::io_context& io_context_; asio::deadline_timer stop_timer_; std::list sessions_; stats stats_; @@ -252,23 +252,23 @@ int main(int argc, char* argv[]) size_t session_count = atoi(argv[5]); int timeout = atoi(argv[6]); - asio::io_service ios; + asio::io_context ioc; - asio::ip::tcp::resolver r(ios); + asio::ip::tcp::resolver r(ioc); asio::ip::tcp::resolver::results_type endpoints = r.resolve(host, port); - client c(ios, endpoints, block_size, session_count, timeout); + client c(ioc, endpoints, block_size, session_count, timeout); std::list threads; while (--thread_count > 0) { asio::thread* new_thread = new asio::thread( - boost::bind(&asio::io_service::run, &ios)); + boost::bind(&asio::io_context::run, &ioc)); threads.push_back(new_thread); } - ios.run(); + ioc.run(); while (!threads.empty()) { diff --git a/asio/src/tests/performance/server.cpp b/asio/src/tests/performance/server.cpp index 9b8a1248..9d050ff7 100644 --- a/asio/src/tests/performance/server.cpp +++ b/asio/src/tests/performance/server.cpp @@ -18,10 +18,10 @@ class session { public: - session(asio::io_service& ios, size_t block_size) - : io_service_(ios), - strand_(ios), - socket_(ios), + session(asio::io_context& ioc, size_t block_size) + : io_context_(ioc), + strand_(ioc), + socket_(ioc), block_size_(block_size), read_data_(new char[block_size]), read_data_length_(0), @@ -59,7 +59,7 @@ public: } else { - asio::post(io_service_, boost::bind(&session::destroy, this)); + asio::post(io_context_, boost::bind(&session::destroy, this)); } } @@ -90,7 +90,7 @@ public: } if (op_count_ == 0) - asio::post(io_service_, boost::bind(&session::destroy, this)); + asio::post(io_context_, boost::bind(&session::destroy, this)); } void handle_write(const asio::error_code& err) @@ -119,7 +119,7 @@ public: } if (op_count_ == 0) - asio::post(io_service_, boost::bind(&session::destroy, this)); + asio::post(io_context_, boost::bind(&session::destroy, this)); } static void destroy(session* s) @@ -128,8 +128,8 @@ public: } private: - asio::io_service& io_service_; - asio::io_service::strand strand_; + asio::io_context& io_context_; + asio::io_context::strand strand_; asio::ip::tcp::socket socket_; size_t block_size_; char* read_data_; @@ -144,10 +144,10 @@ private: class server { public: - server(asio::io_service& ios, const asio::ip::tcp::endpoint& endpoint, + server(asio::io_context& ioc, const asio::ip::tcp::endpoint& endpoint, size_t block_size) - : io_service_(ios), - acceptor_(ios), + : io_context_(ioc), + acceptor_(ioc), block_size_(block_size) { acceptor_.open(endpoint.protocol()); @@ -160,7 +160,7 @@ public: void start_accept() { - session* new_session = new session(io_service_, block_size_); + session* new_session = new session(io_context_, block_size_); acceptor_.async_accept(new_session->socket(), boost::bind(&server::handle_accept, this, new_session, asio::placeholders::error)); @@ -181,7 +181,7 @@ public: } private: - asio::io_service& io_service_; + asio::io_context& io_context_; asio::ip::tcp::acceptor acceptor_; size_t block_size_; }; @@ -202,20 +202,20 @@ int main(int argc, char* argv[]) int thread_count = atoi(argv[3]); size_t block_size = atoi(argv[4]); - asio::io_service ios; + asio::io_context ioc; - server s(ios, asio::ip::tcp::endpoint(address, port), block_size); + server s(ioc, asio::ip::tcp::endpoint(address, port), block_size); // Threads not currently supported in this test. std::list threads; while (--thread_count > 0) { asio::thread* new_thread = new asio::thread( - boost::bind(&asio::io_service::run, &ios)); + boost::bind(&asio::io_context::run, &ioc)); threads.push_back(new_thread); } - ios.run(); + ioc.run(); while (!threads.empty()) { diff --git a/asio/src/tests/unit/buffered_read_stream.cpp b/asio/src/tests/unit/buffered_read_stream.cpp index 95f2b7a3..06047c2e 100644 --- a/asio/src/tests/unit/buffered_read_stream.cpp +++ b/asio/src/tests/unit/buffered_read_stream.cpp @@ -19,7 +19,7 @@ #include #include "archetypes/async_result.hpp" #include "asio/buffer.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/ip/tcp.hpp" #include "asio/system_error.hpp" #include "unit_test.hpp" @@ -63,7 +63,7 @@ void test_compile() try { - io_service ios; + io_context ioc; char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; array mutable_buffers = {{ @@ -75,11 +75,11 @@ void test_compile() archetypes::lazy_handler lazy; asio::error_code ec; - stream_type stream1(ios); - stream_type stream2(ios, 1024); + stream_type stream1(ioc); + stream_type stream2(ioc, 1024); - io_service& ios_ref = stream1.get_io_service(); - (void)ios_ref; + io_context& ioc_ref = stream1.get_io_context(); + (void)ioc_ref; stream_type::lowest_layer_type& lowest_layer = stream1.lowest_layer(); (void)lowest_layer; @@ -144,17 +144,17 @@ void test_sync_operations() { using namespace std; // For memcmp. - asio::io_service io_service; + asio::io_context io_context; - asio::ip::tcp::acceptor acceptor(io_service, + asio::ip::tcp::acceptor acceptor(io_context, asio::ip::tcp::endpoint(asio::ip::tcp::v4(), 0)); asio::ip::tcp::endpoint server_endpoint = acceptor.local_endpoint(); server_endpoint.address(asio::ip::address_v4::loopback()); - stream_type client_socket(io_service); + stream_type client_socket(io_context); client_socket.lowest_layer().connect(server_endpoint); - stream_type server_socket(io_service); + stream_type server_socket(io_context); acceptor.accept(server_socket.lowest_layer()); const char write_data[] @@ -255,20 +255,20 @@ void test_async_operations() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service io_service; + asio::io_context io_context; - asio::ip::tcp::acceptor acceptor(io_service, + asio::ip::tcp::acceptor acceptor(io_context, asio::ip::tcp::endpoint(asio::ip::tcp::v4(), 0)); asio::ip::tcp::endpoint server_endpoint = acceptor.local_endpoint(); server_endpoint.address(asio::ip::address_v4::loopback()); - stream_type client_socket(io_service); + stream_type client_socket(io_context); client_socket.lowest_layer().connect(server_endpoint); - stream_type server_socket(io_service); + stream_type server_socket(io_context); acceptor.async_accept(server_socket.lowest_layer(), &handle_accept); - io_service.run(); - io_service.restart(); + io_context.run(); + io_context.restart(); const char write_data[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; @@ -280,8 +280,8 @@ void test_async_operations() client_socket.async_write_some( asio::buffer(write_buf + bytes_written), bindns::bind(handle_write, _1, _2, &bytes_written)); - io_service.run(); - io_service.restart(); + io_context.run(); + io_context.restart(); } char read_data[sizeof(write_data)]; @@ -293,8 +293,8 @@ void test_async_operations() server_socket.async_read_some( asio::buffer(read_buf + bytes_read), bindns::bind(handle_read, _1, _2, &bytes_read)); - io_service.run(); - io_service.restart(); + io_context.run(); + io_context.restart(); } ASIO_CHECK(bytes_written == sizeof(write_data)); @@ -307,8 +307,8 @@ void test_async_operations() server_socket.async_write_some( asio::buffer(write_buf + bytes_written), bindns::bind(handle_write, _1, _2, &bytes_written)); - io_service.run(); - io_service.restart(); + io_context.run(); + io_context.restart(); } bytes_read = 0; @@ -317,8 +317,8 @@ void test_async_operations() client_socket.async_read_some( asio::buffer(read_buf + bytes_read), bindns::bind(handle_read, _1, _2, &bytes_read)); - io_service.run(); - io_service.restart(); + io_context.run(); + io_context.restart(); } ASIO_CHECK(bytes_written == sizeof(write_data)); diff --git a/asio/src/tests/unit/buffered_stream.cpp b/asio/src/tests/unit/buffered_stream.cpp index 63028a50..a55a2a59 100644 --- a/asio/src/tests/unit/buffered_stream.cpp +++ b/asio/src/tests/unit/buffered_stream.cpp @@ -19,7 +19,7 @@ #include #include "archetypes/async_result.hpp" #include "asio/buffer.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/ip/tcp.hpp" #include "asio/system_error.hpp" #include "unit_test.hpp" @@ -67,7 +67,7 @@ void test_compile() try { - io_service ios; + io_context ioc; char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; array mutable_buffers = {{ @@ -79,11 +79,11 @@ void test_compile() archetypes::lazy_handler lazy; asio::error_code ec; - stream_type stream1(ios); - stream_type stream2(ios, 1024, 1024); + stream_type stream1(ioc); + stream_type stream2(ioc, 1024, 1024); - io_service& ios_ref = stream1.get_io_service(); - (void)ios_ref; + io_context& ioc_ref = stream1.get_io_context(); + (void)ioc_ref; stream_type::lowest_layer_type& lowest_layer = stream1.lowest_layer(); (void)lowest_layer; @@ -155,17 +155,17 @@ void test_sync_operations() { using namespace std; // For memcmp. - asio::io_service io_service; + asio::io_context io_context; - asio::ip::tcp::acceptor acceptor(io_service, + asio::ip::tcp::acceptor acceptor(io_context, asio::ip::tcp::endpoint(asio::ip::tcp::v4(), 0)); asio::ip::tcp::endpoint server_endpoint = acceptor.local_endpoint(); server_endpoint.address(asio::ip::address_v4::loopback()); - stream_type client_socket(io_service); + stream_type client_socket(io_context); client_socket.lowest_layer().connect(server_endpoint); - stream_type server_socket(io_service); + stream_type server_socket(io_context); acceptor.accept(server_socket.lowest_layer()); const char write_data[] @@ -273,20 +273,20 @@ void test_async_operations() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service io_service; + asio::io_context io_context; - asio::ip::tcp::acceptor acceptor(io_service, + asio::ip::tcp::acceptor acceptor(io_context, asio::ip::tcp::endpoint(asio::ip::tcp::v4(), 0)); asio::ip::tcp::endpoint server_endpoint = acceptor.local_endpoint(); server_endpoint.address(asio::ip::address_v4::loopback()); - stream_type client_socket(io_service); + stream_type client_socket(io_context); client_socket.lowest_layer().connect(server_endpoint); - stream_type server_socket(io_service); + stream_type server_socket(io_context); acceptor.async_accept(server_socket.lowest_layer(), &handle_accept); - io_service.run(); - io_service.restart(); + io_context.run(); + io_context.restart(); const char write_data[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; @@ -298,12 +298,12 @@ void test_async_operations() client_socket.async_write_some( asio::buffer(write_buf + bytes_written), bindns::bind(handle_write, _1, _2, &bytes_written)); - io_service.run(); - io_service.restart(); + io_context.run(); + io_context.restart(); client_socket.async_flush( bindns::bind(handle_flush, _1)); - io_service.run(); - io_service.restart(); + io_context.run(); + io_context.restart(); } char read_data[sizeof(write_data)]; @@ -315,8 +315,8 @@ void test_async_operations() server_socket.async_read_some( asio::buffer(read_buf + bytes_read), bindns::bind(handle_read, _1, _2, &bytes_read)); - io_service.run(); - io_service.restart(); + io_context.run(); + io_context.restart(); } ASIO_CHECK(bytes_written == sizeof(write_data)); @@ -329,12 +329,12 @@ void test_async_operations() server_socket.async_write_some( asio::buffer(write_buf + bytes_written), bindns::bind(handle_write, _1, _2, &bytes_written)); - io_service.run(); - io_service.restart(); + io_context.run(); + io_context.restart(); server_socket.async_flush( bindns::bind(handle_flush, _1)); - io_service.run(); - io_service.restart(); + io_context.run(); + io_context.restart(); } bytes_read = 0; @@ -343,8 +343,8 @@ void test_async_operations() client_socket.async_read_some( asio::buffer(read_buf + bytes_read), bindns::bind(handle_read, _1, _2, &bytes_read)); - io_service.run(); - io_service.restart(); + io_context.run(); + io_context.restart(); } ASIO_CHECK(bytes_written == sizeof(write_data)); diff --git a/asio/src/tests/unit/buffered_write_stream.cpp b/asio/src/tests/unit/buffered_write_stream.cpp index 48b9db54..cf3a8199 100644 --- a/asio/src/tests/unit/buffered_write_stream.cpp +++ b/asio/src/tests/unit/buffered_write_stream.cpp @@ -19,7 +19,7 @@ #include #include "archetypes/async_result.hpp" #include "asio/buffer.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/ip/tcp.hpp" #include "asio/system_error.hpp" #include "unit_test.hpp" @@ -63,7 +63,7 @@ void test_compile() try { - io_service ios; + io_context ioc; char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; array mutable_buffers = {{ @@ -75,11 +75,11 @@ void test_compile() archetypes::lazy_handler lazy; asio::error_code ec; - stream_type stream1(ios); - stream_type stream2(ios, 1024); + stream_type stream1(ioc); + stream_type stream2(ioc, 1024); - io_service& ios_ref = stream1.get_io_service(); - (void)ios_ref; + io_context& ioc_ref = stream1.get_io_context(); + (void)ioc_ref; stream_type::lowest_layer_type& lowest_layer = stream1.lowest_layer(); (void)lowest_layer; @@ -144,17 +144,17 @@ void test_sync_operations() { using namespace std; // For memcmp. - asio::io_service io_service; + asio::io_context io_context; - asio::ip::tcp::acceptor acceptor(io_service, + asio::ip::tcp::acceptor acceptor(io_context, asio::ip::tcp::endpoint(asio::ip::tcp::v4(), 0)); asio::ip::tcp::endpoint server_endpoint = acceptor.local_endpoint(); server_endpoint.address(asio::ip::address_v4::loopback()); - stream_type client_socket(io_service); + stream_type client_socket(io_context); client_socket.lowest_layer().connect(server_endpoint); - stream_type server_socket(io_service); + stream_type server_socket(io_context); acceptor.accept(server_socket.lowest_layer()); const char write_data[] @@ -262,20 +262,20 @@ void test_async_operations() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service io_service; + asio::io_context io_context; - asio::ip::tcp::acceptor acceptor(io_service, + asio::ip::tcp::acceptor acceptor(io_context, asio::ip::tcp::endpoint(asio::ip::tcp::v4(), 0)); asio::ip::tcp::endpoint server_endpoint = acceptor.local_endpoint(); server_endpoint.address(asio::ip::address_v4::loopback()); - stream_type client_socket(io_service); + stream_type client_socket(io_context); client_socket.lowest_layer().connect(server_endpoint); - stream_type server_socket(io_service); + stream_type server_socket(io_context); acceptor.async_accept(server_socket.lowest_layer(), &handle_accept); - io_service.run(); - io_service.restart(); + io_context.run(); + io_context.restart(); const char write_data[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; @@ -287,12 +287,12 @@ void test_async_operations() client_socket.async_write_some( asio::buffer(write_buf + bytes_written), bindns::bind(handle_write, _1, _2, &bytes_written)); - io_service.run(); - io_service.restart(); + io_context.run(); + io_context.restart(); client_socket.async_flush( bindns::bind(handle_flush, _1)); - io_service.run(); - io_service.restart(); + io_context.run(); + io_context.restart(); } char read_data[sizeof(write_data)]; @@ -304,8 +304,8 @@ void test_async_operations() server_socket.async_read_some( asio::buffer(read_buf + bytes_read), bindns::bind(handle_read, _1, _2, &bytes_read)); - io_service.run(); - io_service.restart(); + io_context.run(); + io_context.restart(); } ASIO_CHECK(bytes_written == sizeof(write_data)); @@ -318,12 +318,12 @@ void test_async_operations() server_socket.async_write_some( asio::buffer(write_buf + bytes_written), bindns::bind(handle_write, _1, _2, &bytes_written)); - io_service.run(); - io_service.restart(); + io_context.run(); + io_context.restart(); server_socket.async_flush( bindns::bind(handle_flush, _1)); - io_service.run(); - io_service.restart(); + io_context.run(); + io_context.restart(); } bytes_read = 0; @@ -332,8 +332,8 @@ void test_async_operations() client_socket.async_read_some( asio::buffer(read_buf + bytes_read), bindns::bind(handle_read, _1, _2, &bytes_read)); - io_service.run(); - io_service.restart(); + io_context.run(); + io_context.restart(); } ASIO_CHECK(bytes_written == sizeof(write_data)); diff --git a/asio/src/tests/unit/deadline_timer.cpp b/asio/src/tests/unit/deadline_timer.cpp index e4464d7a..364491c8 100644 --- a/asio/src/tests/unit/deadline_timer.cpp +++ b/asio/src/tests/unit/deadline_timer.cpp @@ -22,7 +22,7 @@ #include #include "archetypes/async_result.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/placeholders.hpp" #include "asio/thread.hpp" @@ -79,12 +79,12 @@ ptime now() void deadline_timer_test() { - asio::io_service ios; + asio::io_context ioc; int count = 0; ptime start = now(); - asio::deadline_timer t1(ios, seconds(1)); + asio::deadline_timer t1(ioc, seconds(1)); t1.wait(); // The timer must block until after its expiry time. @@ -94,7 +94,7 @@ void deadline_timer_test() start = now(); - asio::deadline_timer t2(ios, seconds(1) + microseconds(500000)); + asio::deadline_timer t2(ioc, seconds(1) + microseconds(500000)); t2.wait(); // The timer must block until after its expiry time. @@ -122,13 +122,13 @@ void deadline_timer_test() start = now(); - asio::deadline_timer t3(ios, seconds(5)); + asio::deadline_timer t3(ioc, seconds(5)); t3.async_wait(boost::bind(increment, &count)); // No completions can be delivered until run() is called. ASIO_CHECK(count == 0); - ios.run(); + ioc.run(); // The run() call will not return until all operations have finished, and // this should not be until after the timer's expiry time. @@ -140,14 +140,14 @@ void deadline_timer_test() count = 3; start = now(); - asio::deadline_timer t4(ios, seconds(1)); + asio::deadline_timer t4(ioc, seconds(1)); t4.async_wait(boost::bind(decrement_to_zero, &t4, &count)); // No completions can be delivered until run() is called. ASIO_CHECK(count == 3); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); // The run() call will not return until all operations have finished, and // this should not be until after the timer's final expiry time. @@ -159,17 +159,17 @@ void deadline_timer_test() count = 0; start = now(); - asio::deadline_timer t5(ios, seconds(10)); + asio::deadline_timer t5(ioc, seconds(10)); t5.async_wait(boost::bind(increment_if_not_cancelled, &count, asio::placeholders::error)); - asio::deadline_timer t6(ios, seconds(1)); + asio::deadline_timer t6(ioc, seconds(1)); t6.async_wait(boost::bind(cancel_timer, &t5)); // No completions can be delivered until run() is called. ASIO_CHECK(count == 0); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); // The timer should have been cancelled, so count should not have changed. // The total run time should not have been much more than 1 second (and @@ -184,8 +184,8 @@ void deadline_timer_test() t5.async_wait(boost::bind(increment_if_not_cancelled, &count, asio::placeholders::error)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); // The timer should not have been cancelled, so count should have changed. // The total time since the timer was created should be more than 10 seconds. @@ -200,16 +200,16 @@ void deadline_timer_test() // Start two waits on a timer, one of which will be cancelled. The one // which is not cancelled should still run to completion and increment the // counter. - asio::deadline_timer t7(ios, seconds(3)); + asio::deadline_timer t7(ioc, seconds(3)); t7.async_wait(boost::bind(increment_if_not_cancelled, &count, asio::placeholders::error)); t7.async_wait(boost::bind(increment_if_not_cancelled, &count, asio::placeholders::error)); - asio::deadline_timer t8(ios, seconds(1)); + asio::deadline_timer t8(ioc, seconds(1)); t8.async_wait(boost::bind(cancel_one_timer, &t7)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); // One of the waits should not have been cancelled, so count should have // changed. The total time since the timer was created should be more than 3 @@ -226,11 +226,11 @@ void timer_handler(const asio::error_code&) void deadline_timer_cancel_test() { - static asio::io_service io_service; + static asio::io_context io_context; struct timer { asio::deadline_timer t; - timer() : t(io_service) { t.expires_at(boost::posix_time::pos_infin); } + timer() : t(io_context) { t.expires_at(boost::posix_time::pos_infin); } } timers[50]; timers[2].t.async_wait(&timer_handler); @@ -267,11 +267,11 @@ void asio_handler_deallocate(void* pointer, std::size_t, void deadline_timer_custom_allocation_test() { - static asio::io_service io_service; + static asio::io_context io_context; struct timer { asio::deadline_timer t; - timer() : t(io_service) {} + timer() : t(io_context) {} } timers[100]; int allocation_count = 0; @@ -291,25 +291,25 @@ void deadline_timer_custom_allocation_test() for (int i = 0; i < 50; ++i) timers[i].t.cancel(); - io_service.run(); + io_context.run(); ASIO_CHECK(allocation_count == 0); } -void io_service_run(asio::io_service* ios) +void io_context_run(asio::io_context* ioc) { - ios->run(); + ioc->run(); } void deadline_timer_thread_test() { - asio::io_service ios; - asio::io_service::work w(ios); - asio::deadline_timer t1(ios); - asio::deadline_timer t2(ios); + asio::io_context ioc; + asio::io_context::work w(ioc); + asio::deadline_timer t1(ioc); + asio::deadline_timer t2(ioc); int count = 0; - asio::thread th(boost::bind(io_service_run, &ios)); + asio::thread th(boost::bind(io_context_run, &ioc)); t2.expires_from_now(boost::posix_time::seconds(2)); t2.wait(); @@ -320,7 +320,7 @@ void deadline_timer_thread_test() t2.expires_from_now(boost::posix_time::seconds(4)); t2.wait(); - ios.stop(); + ioc.stop(); th.join(); ASIO_CHECK(count == 1); @@ -328,14 +328,14 @@ void deadline_timer_thread_test() void deadline_timer_async_result_test() { - asio::io_service ios; - asio::deadline_timer t1(ios); + asio::io_context ioc; + asio::deadline_timer t1(ioc); t1.expires_from_now(boost::posix_time::seconds(1)); int i = t1.async_wait(archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.run(); + ioc.run(); } ASIO_TEST_SUITE diff --git a/asio/src/tests/unit/generic/datagram_protocol.cpp b/asio/src/tests/unit/generic/datagram_protocol.cpp index 24ab9d34..58da16a8 100644 --- a/asio/src/tests/unit/generic/datagram_protocol.cpp +++ b/asio/src/tests/unit/generic/datagram_protocol.cpp @@ -17,7 +17,7 @@ #include "asio/generic/datagram_protocol.hpp" #include -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/ip/udp.hpp" #include "../unit_test.hpp" @@ -59,7 +59,7 @@ void test() try { - io_service ios; + io_context ioc; char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; socket_base::message_flags in_flags = 0; @@ -69,33 +69,33 @@ void test() // basic_datagram_socket constructors. - dp::socket socket1(ios); - dp::socket socket2(ios, dp(af_inet, ipproto_udp)); - dp::socket socket3(ios, dp::endpoint()); + dp::socket socket1(ioc); + dp::socket socket2(ioc, dp(af_inet, ipproto_udp)); + dp::socket socket3(ioc, dp::endpoint()); #if !defined(ASIO_WINDOWS_RUNTIME) dp::socket::native_handle_type native_socket1 = ::socket(af_inet, sock_dgram, 0); - dp::socket socket4(ios, dp(af_inet, ipproto_udp), native_socket1); + dp::socket socket4(ioc, dp(af_inet, ipproto_udp), native_socket1); #endif // !defined(ASIO_WINDOWS_RUNTIME) #if defined(ASIO_HAS_MOVE) dp::socket socket5(std::move(socket4)); - asio::ip::udp::socket udp_socket(ios); + asio::ip::udp::socket udp_socket(ioc); dp::socket socket6(std::move(udp_socket)); #endif // defined(ASIO_HAS_MOVE) // basic_datagram_socket operators. #if defined(ASIO_HAS_MOVE) - socket1 = dp::socket(ios); + socket1 = dp::socket(ioc); socket1 = std::move(socket2); - socket1 = asio::ip::udp::socket(ios); + socket1 = asio::ip::udp::socket(ioc); #endif // defined(ASIO_HAS_MOVE) // basic_io_object functions. - io_service& ios_ref = socket1.get_io_service(); - (void)ios_ref; + io_context& ioc_ref = socket1.get_io_context(); + (void)ioc_ref; // basic_socket functions. diff --git a/asio/src/tests/unit/generic/raw_protocol.cpp b/asio/src/tests/unit/generic/raw_protocol.cpp index fd8dd4f8..0ba8c119 100644 --- a/asio/src/tests/unit/generic/raw_protocol.cpp +++ b/asio/src/tests/unit/generic/raw_protocol.cpp @@ -17,7 +17,7 @@ #include "asio/generic/raw_protocol.hpp" #include -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/ip/icmp.hpp" #include "../unit_test.hpp" @@ -59,7 +59,7 @@ void test() try { - io_service ios; + io_context ioc; char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; socket_base::message_flags in_flags = 0; @@ -69,33 +69,33 @@ void test() // basic_raw_socket constructors. - rp::socket socket1(ios); - rp::socket socket2(ios, rp(af_inet, ipproto_icmp)); - rp::socket socket3(ios, rp::endpoint()); + rp::socket socket1(ioc); + rp::socket socket2(ioc, rp(af_inet, ipproto_icmp)); + rp::socket socket3(ioc, rp::endpoint()); #if !defined(ASIO_WINDOWS_RUNTIME) rp::socket::native_handle_type native_socket1 = ::socket(af_inet, sock_raw, 0); - rp::socket socket4(ios, rp(af_inet, ipproto_icmp), native_socket1); + rp::socket socket4(ioc, rp(af_inet, ipproto_icmp), native_socket1); #endif // !defined(ASIO_WINDOWS_RUNTIME) #if defined(ASIO_HAS_MOVE) rp::socket socket5(std::move(socket4)); - asio::ip::icmp::socket icmp_socket(ios); + asio::ip::icmp::socket icmp_socket(ioc); rp::socket socket6(std::move(icmp_socket)); #endif // defined(ASIO_HAS_MOVE) // basic_datagram_socket operators. #if defined(ASIO_HAS_MOVE) - socket1 = rp::socket(ios); + socket1 = rp::socket(ioc); socket1 = std::move(socket2); - socket1 = asio::ip::icmp::socket(ios); + socket1 = asio::ip::icmp::socket(ioc); #endif // defined(ASIO_HAS_MOVE) // basic_io_object functions. - io_service& ios_ref = socket1.get_io_service(); - (void)ios_ref; + io_context& ioc_ref = socket1.get_io_context(); + (void)ioc_ref; // basic_socket functions. diff --git a/asio/src/tests/unit/generic/seq_packet_protocol.cpp b/asio/src/tests/unit/generic/seq_packet_protocol.cpp index 61222dde..a2ba7be7 100644 --- a/asio/src/tests/unit/generic/seq_packet_protocol.cpp +++ b/asio/src/tests/unit/generic/seq_packet_protocol.cpp @@ -17,7 +17,7 @@ #include "asio/generic/seq_packet_protocol.hpp" #include -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "../unit_test.hpp" #if defined(__cplusplus_cli) || defined(__cplusplus_winrt) @@ -57,7 +57,7 @@ void test() try { - io_service ios; + io_context ioc; char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; const socket_base::message_flags in_flags = 0; @@ -68,13 +68,13 @@ void test() // basic_seq_packet_socket constructors. - spp::socket socket1(ios); - spp::socket socket2(ios, spp(af_inet, 0)); - spp::socket socket3(ios, spp::endpoint()); + spp::socket socket1(ioc); + spp::socket socket2(ioc, spp(af_inet, 0)); + spp::socket socket3(ioc, spp::endpoint()); #if !defined(ASIO_WINDOWS_RUNTIME) spp::socket::native_handle_type native_socket1 = ::socket(af_inet, sock_seqpacket, 0); - spp::socket socket4(ios, spp(af_inet, 0), native_socket1); + spp::socket socket4(ioc, spp(af_inet, 0), native_socket1); #endif // !defined(ASIO_WINDOWS_RUNTIME) #if defined(ASIO_HAS_MOVE) @@ -84,14 +84,14 @@ void test() // basic_seq_packet_socket operators. #if defined(ASIO_HAS_MOVE) - socket1 = spp::socket(ios); + socket1 = spp::socket(ioc); socket1 = std::move(socket2); #endif // defined(ASIO_HAS_MOVE) // basic_io_object functions. - io_service& ios_ref = socket1.get_io_service(); - (void)ios_ref; + io_context& ioc_ref = socket1.get_io_context(); + (void)ioc_ref; // basic_socket functions. diff --git a/asio/src/tests/unit/generic/stream_protocol.cpp b/asio/src/tests/unit/generic/stream_protocol.cpp index 6db459c3..4a93f26f 100644 --- a/asio/src/tests/unit/generic/stream_protocol.cpp +++ b/asio/src/tests/unit/generic/stream_protocol.cpp @@ -17,7 +17,7 @@ #include "asio/generic/stream_protocol.hpp" #include -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/ip/tcp.hpp" #include "../unit_test.hpp" @@ -67,7 +67,7 @@ void test() try { - io_service ios; + io_context ioc; char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; socket_base::message_flags in_flags = 0; @@ -77,35 +77,35 @@ void test() // basic_stream_socket constructors. - sp::socket socket1(ios); - sp::socket socket2(ios, sp(af_inet, ipproto_tcp)); - sp::socket socket3(ios, sp::endpoint()); + sp::socket socket1(ioc); + sp::socket socket2(ioc, sp(af_inet, ipproto_tcp)); + sp::socket socket3(ioc, sp::endpoint()); #if defined(ASIO_WINDOWS_RUNTIME) Windows::Networking::Sockets::StreamSocket^ native_socket1 = nullptr; #else // defined(ASIO_WINDOWS_RUNTIME) sp::socket::native_handle_type native_socket1 = ::socket(af_inet, sock_stream, 0); #endif // defined(ASIO_WINDOWS_RUNTIME) - sp::socket socket4(ios, sp(af_inet, ipproto_tcp), native_socket1); + sp::socket socket4(ioc, sp(af_inet, ipproto_tcp), native_socket1); #if defined(ASIO_HAS_MOVE) sp::socket socket5(std::move(socket4)); - asio::ip::tcp::socket tcp_socket(ios); + asio::ip::tcp::socket tcp_socket(ioc); sp::socket socket6(std::move(tcp_socket)); #endif // defined(ASIO_HAS_MOVE) // basic_stream_socket operators. #if defined(ASIO_HAS_MOVE) - socket1 = sp::socket(ios); + socket1 = sp::socket(ioc); socket1 = std::move(socket2); - socket1 = asio::ip::tcp::socket(ios); + socket1 = asio::ip::tcp::socket(ioc); #endif // defined(ASIO_HAS_MOVE) // basic_io_object functions. - io_service& ios_ref = socket1.get_io_service(); - (void)ios_ref; + io_context& ioc_ref = socket1.get_io_context(); + (void)ioc_ref; // basic_socket functions. diff --git a/asio/src/tests/unit/io_service.cpp b/asio/src/tests/unit/io_context.cpp similarity index 55% rename from asio/src/tests/unit/io_service.cpp rename to asio/src/tests/unit/io_context.cpp index 1da553bb..833c1b73 100644 --- a/asio/src/tests/unit/io_service.cpp +++ b/asio/src/tests/unit/io_context.cpp @@ -1,5 +1,5 @@ // -// io_service.cpp +// io_context.cpp // ~~~~~~~~~~~~~~ // // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) @@ -14,7 +14,7 @@ #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include #include "asio/thread.hpp" @@ -56,50 +56,50 @@ void increment(int* count) ++(*count); } -void decrement_to_zero(io_service* ios, int* count) +void decrement_to_zero(io_context* ioc, int* count) { if (*count > 0) { --(*count); int before_value = *count; - ios->post(bindns::bind(decrement_to_zero, ios, count)); + ioc->post(bindns::bind(decrement_to_zero, ioc, count)); // Handler execution cannot nest, so count value should remain unchanged. ASIO_CHECK(*count == before_value); } } -void nested_decrement_to_zero(io_service* ios, int* count) +void nested_decrement_to_zero(io_context* ioc, int* count) { if (*count > 0) { --(*count); - ios->dispatch(bindns::bind(nested_decrement_to_zero, ios, count)); + ioc->dispatch(bindns::bind(nested_decrement_to_zero, ioc, count)); // Handler execution is nested, so count value should now be zero. ASIO_CHECK(*count == 0); } } -void sleep_increment(io_service* ios, int* count) +void sleep_increment(io_context* ioc, int* count) { - timer t(*ios, chronons::seconds(2)); + timer t(*ioc, chronons::seconds(2)); t.wait(); if (++(*count) < 3) - ios->post(bindns::bind(sleep_increment, ios, count)); + ioc->post(bindns::bind(sleep_increment, ioc, count)); } -void start_sleep_increments(io_service* ios, int* count) +void start_sleep_increments(io_context* ioc, int* count) { // Give all threads a chance to start. - timer t(*ios, chronons::seconds(2)); + timer t(*ioc, chronons::seconds(2)); t.wait(); // Start the first of three increments. - ios->post(bindns::bind(sleep_increment, ios, count)); + ioc->post(bindns::bind(sleep_increment, ioc, count)); } void throw_exception() @@ -107,158 +107,158 @@ void throw_exception() throw 1; } -void io_service_run(io_service* ios) +void io_context_run(io_context* ioc) { - ios->run(); + ioc->run(); } -void io_service_test() +void io_context_test() { - io_service ios; + io_context ioc; int count = 0; - ios.post(bindns::bind(increment, &count)); + ioc.post(bindns::bind(increment, &count)); // No handlers can be called until run() is called. - ASIO_CHECK(!ios.stopped()); + ASIO_CHECK(!ioc.stopped()); ASIO_CHECK(count == 0); - ios.run(); + ioc.run(); // The run() call will not return until all work has finished. - ASIO_CHECK(ios.stopped()); + ASIO_CHECK(ioc.stopped()); ASIO_CHECK(count == 1); count = 0; - ios.restart(); - ios.post(bindns::bind(increment, &count)); - ios.post(bindns::bind(increment, &count)); - ios.post(bindns::bind(increment, &count)); - ios.post(bindns::bind(increment, &count)); - ios.post(bindns::bind(increment, &count)); + ioc.restart(); + ioc.post(bindns::bind(increment, &count)); + ioc.post(bindns::bind(increment, &count)); + ioc.post(bindns::bind(increment, &count)); + ioc.post(bindns::bind(increment, &count)); + ioc.post(bindns::bind(increment, &count)); // No handlers can be called until run() is called. - ASIO_CHECK(!ios.stopped()); + ASIO_CHECK(!ioc.stopped()); ASIO_CHECK(count == 0); - ios.run(); + ioc.run(); // The run() call will not return until all work has finished. - ASIO_CHECK(ios.stopped()); + ASIO_CHECK(ioc.stopped()); ASIO_CHECK(count == 5); count = 0; - ios.restart(); - io_service::work* w = new io_service::work(ios); - ios.post(bindns::bind(&io_service::stop, &ios)); - ASIO_CHECK(!ios.stopped()); - ios.run(); + ioc.restart(); + io_context::work* w = new io_context::work(ioc); + ioc.post(bindns::bind(&io_context::stop, &ioc)); + ASIO_CHECK(!ioc.stopped()); + ioc.run(); // The only operation executed should have been to stop run(). - ASIO_CHECK(ios.stopped()); + ASIO_CHECK(ioc.stopped()); ASIO_CHECK(count == 0); - ios.restart(); - ios.post(bindns::bind(increment, &count)); + ioc.restart(); + ioc.post(bindns::bind(increment, &count)); delete w; // No handlers can be called until run() is called. - ASIO_CHECK(!ios.stopped()); + ASIO_CHECK(!ioc.stopped()); ASIO_CHECK(count == 0); - ios.run(); + ioc.run(); // The run() call will not return until all work has finished. - ASIO_CHECK(ios.stopped()); + ASIO_CHECK(ioc.stopped()); ASIO_CHECK(count == 1); count = 10; - ios.restart(); - ios.post(bindns::bind(decrement_to_zero, &ios, &count)); + ioc.restart(); + ioc.post(bindns::bind(decrement_to_zero, &ioc, &count)); // No handlers can be called until run() is called. - ASIO_CHECK(!ios.stopped()); + ASIO_CHECK(!ioc.stopped()); ASIO_CHECK(count == 10); - ios.run(); + ioc.run(); // The run() call will not return until all work has finished. - ASIO_CHECK(ios.stopped()); + ASIO_CHECK(ioc.stopped()); ASIO_CHECK(count == 0); count = 10; - ios.restart(); - ios.post(bindns::bind(nested_decrement_to_zero, &ios, &count)); + ioc.restart(); + ioc.post(bindns::bind(nested_decrement_to_zero, &ioc, &count)); // No handlers can be called until run() is called. - ASIO_CHECK(!ios.stopped()); + ASIO_CHECK(!ioc.stopped()); ASIO_CHECK(count == 10); - ios.run(); + ioc.run(); // The run() call will not return until all work has finished. - ASIO_CHECK(ios.stopped()); + ASIO_CHECK(ioc.stopped()); ASIO_CHECK(count == 0); count = 10; - ios.restart(); - ios.dispatch(bindns::bind(nested_decrement_to_zero, &ios, &count)); + ioc.restart(); + ioc.dispatch(bindns::bind(nested_decrement_to_zero, &ioc, &count)); // No handlers can be called until run() is called, even though nested // delivery was specifically allowed in the previous call. - ASIO_CHECK(!ios.stopped()); + ASIO_CHECK(!ioc.stopped()); ASIO_CHECK(count == 10); - ios.run(); + ioc.run(); // The run() call will not return until all work has finished. - ASIO_CHECK(ios.stopped()); + ASIO_CHECK(ioc.stopped()); ASIO_CHECK(count == 0); count = 0; int count2 = 0; - ios.restart(); - ASIO_CHECK(!ios.stopped()); - ios.post(bindns::bind(start_sleep_increments, &ios, &count)); - ios.post(bindns::bind(start_sleep_increments, &ios, &count2)); - thread thread1(bindns::bind(io_service_run, &ios)); - thread thread2(bindns::bind(io_service_run, &ios)); + ioc.restart(); + ASIO_CHECK(!ioc.stopped()); + ioc.post(bindns::bind(start_sleep_increments, &ioc, &count)); + ioc.post(bindns::bind(start_sleep_increments, &ioc, &count2)); + thread thread1(bindns::bind(io_context_run, &ioc)); + thread thread2(bindns::bind(io_context_run, &ioc)); thread1.join(); thread2.join(); // The run() calls will not return until all work has finished. - ASIO_CHECK(ios.stopped()); + ASIO_CHECK(ioc.stopped()); ASIO_CHECK(count == 3); ASIO_CHECK(count2 == 3); count = 10; - io_service ios2; - ios.dispatch(ios2.wrap(bindns::bind(decrement_to_zero, &ios2, &count))); - ios.restart(); - ASIO_CHECK(!ios.stopped()); - ios.run(); + io_context ioc2; + ioc.dispatch(ioc2.wrap(bindns::bind(decrement_to_zero, &ioc2, &count))); + ioc.restart(); + ASIO_CHECK(!ioc.stopped()); + ioc.run(); // No decrement_to_zero handlers can be called until run() is called on the - // second io_service object. - ASIO_CHECK(ios.stopped()); + // second io_context object. + ASIO_CHECK(ioc.stopped()); ASIO_CHECK(count == 10); - ios2.run(); + ioc2.run(); // The run() call will not return until all work has finished. ASIO_CHECK(count == 0); count = 0; int exception_count = 0; - ios.restart(); - ios.post(&throw_exception); - ios.post(bindns::bind(increment, &count)); - ios.post(bindns::bind(increment, &count)); - ios.post(&throw_exception); - ios.post(bindns::bind(increment, &count)); + ioc.restart(); + ioc.post(&throw_exception); + ioc.post(bindns::bind(increment, &count)); + ioc.post(bindns::bind(increment, &count)); + ioc.post(&throw_exception); + ioc.post(bindns::bind(increment, &count)); // No handlers can be called until run() is called. - ASIO_CHECK(!ios.stopped()); + ASIO_CHECK(!ioc.stopped()); ASIO_CHECK(count == 0); ASIO_CHECK(exception_count == 0); @@ -266,7 +266,7 @@ void io_service_test() { try { - ios.run(); + ioc.run(); break; } catch (int) @@ -276,39 +276,39 @@ void io_service_test() } // The run() calls will not return until all work has finished. - ASIO_CHECK(ios.stopped()); + ASIO_CHECK(ioc.stopped()); ASIO_CHECK(count == 3); ASIO_CHECK(exception_count == 2); } -class test_service : public asio::io_service::service +class test_service : public asio::io_context::service { public: - static asio::io_service::id id; - test_service(asio::io_service& s) - : asio::io_service::service(s) {} + static asio::io_context::id id; + test_service(asio::io_context& s) + : asio::io_context::service(s) {} private: virtual void shutdown_service() {} }; -asio::io_service::id test_service::id; +asio::io_context::id test_service::id; -void io_service_service_test() +void io_context_service_test() { - asio::io_service ios1; - asio::io_service ios2; - asio::io_service ios3; + asio::io_context ioc1; + asio::io_context ioc2; + asio::io_context ioc3; // Implicit service registration. - asio::use_service(ios1); + asio::use_service(ioc1); - ASIO_CHECK(asio::has_service(ios1)); + ASIO_CHECK(asio::has_service(ioc1)); - test_service* svc1 = new test_service(ios1); + test_service* svc1 = new test_service(ioc1); try { - asio::add_service(ios1, svc1); + asio::add_service(ioc1, svc1); ASIO_ERROR("add_service did not throw"); } catch (asio::service_already_exists&) @@ -318,16 +318,16 @@ void io_service_service_test() // Explicit service registration. - test_service* svc2 = new test_service(ios2); - asio::add_service(ios2, svc2); + test_service* svc2 = new test_service(ioc2); + asio::add_service(ioc2, svc2); - ASIO_CHECK(asio::has_service(ios2)); - ASIO_CHECK(&asio::use_service(ios2) == svc2); + ASIO_CHECK(asio::has_service(ioc2)); + ASIO_CHECK(&asio::use_service(ioc2) == svc2); - test_service* svc3 = new test_service(ios2); + test_service* svc3 = new test_service(ioc2); try { - asio::add_service(ios2, svc3); + asio::add_service(ioc2, svc3); ASIO_ERROR("add_service did not throw"); } catch (asio::service_already_exists&) @@ -337,10 +337,10 @@ void io_service_service_test() // Explicit registration with invalid owner. - test_service* svc4 = new test_service(ios2); + test_service* svc4 = new test_service(ioc2); try { - asio::add_service(ios3, svc4); + asio::add_service(ioc3, svc4); ASIO_ERROR("add_service did not throw"); } catch (asio::invalid_service_owner&) @@ -348,12 +348,12 @@ void io_service_service_test() } delete svc4; - ASIO_CHECK(!asio::has_service(ios3)); + ASIO_CHECK(!asio::has_service(ioc3)); } ASIO_TEST_SUITE ( - "io_service", - ASIO_TEST_CASE(io_service_test) - ASIO_TEST_CASE(io_service_service_test) + "io_context", + ASIO_TEST_CASE(io_context_test) + ASIO_TEST_CASE(io_context_service_test) ) diff --git a/asio/src/tests/unit/ip/icmp.cpp b/asio/src/tests/unit/ip/icmp.cpp index 56069959..783d9a87 100644 --- a/asio/src/tests/unit/ip/icmp.cpp +++ b/asio/src/tests/unit/ip/icmp.cpp @@ -17,7 +17,7 @@ #include "asio/ip/icmp.hpp" #include -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/placeholders.hpp" #include "../unit_test.hpp" #include "../archetypes/gettable_socket_option.hpp" @@ -74,7 +74,7 @@ void test() try { - io_service ios; + io_context ioc; char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; socket_base::message_flags in_flags = 0; @@ -90,15 +90,15 @@ void test() // basic_datagram_socket constructors. - ip::icmp::socket socket1(ios); - ip::icmp::socket socket2(ios, ip::icmp::v4()); - ip::icmp::socket socket3(ios, ip::icmp::v6()); - ip::icmp::socket socket4(ios, ip::icmp::endpoint(ip::icmp::v4(), 0)); - ip::icmp::socket socket5(ios, ip::icmp::endpoint(ip::icmp::v6(), 0)); + ip::icmp::socket socket1(ioc); + ip::icmp::socket socket2(ioc, ip::icmp::v4()); + ip::icmp::socket socket3(ioc, ip::icmp::v6()); + ip::icmp::socket socket4(ioc, ip::icmp::endpoint(ip::icmp::v4(), 0)); + ip::icmp::socket socket5(ioc, ip::icmp::endpoint(ip::icmp::v6(), 0)); #if !defined(ASIO_WINDOWS_RUNTIME) ip::icmp::socket::native_handle_type native_socket1 = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - ip::icmp::socket socket6(ios, ip::icmp::v4(), native_socket1); + ip::icmp::socket socket6(ioc, ip::icmp::v4(), native_socket1); #endif // !defined(ASIO_WINDOWS_RUNTIME) #if defined(ASIO_HAS_MOVE) @@ -108,14 +108,14 @@ void test() // basic_datagram_socket operators. #if defined(ASIO_HAS_MOVE) - socket1 = ip::icmp::socket(ios); + socket1 = ip::icmp::socket(ioc); socket1 = std::move(socket2); #endif // defined(ASIO_HAS_MOVE) // basic_io_object functions. - io_service& ios_ref = socket1.get_io_service(); - (void)ios_ref; + io_context& ioc_ref = socket1.get_io_context(); + (void)ioc_ref; // basic_socket functions. @@ -434,7 +434,7 @@ void test() try { - io_service ios; + io_context ioc; archetypes::lazy_handler lazy; asio::error_code ec; ip::icmp::resolver::query q(ip::icmp::v4(), "localhost", "0"); @@ -442,12 +442,12 @@ void test() // basic_resolver constructors. - ip::icmp::resolver resolver(ios); + ip::icmp::resolver resolver(ioc); // basic_io_object functions. - io_service& ios_ref = resolver.get_io_service(); - (void)ios_ref; + io_context& ioc_ref = resolver.get_io_context(); + (void)ioc_ref; // basic_resolver functions. diff --git a/asio/src/tests/unit/ip/multicast.cpp b/asio/src/tests/unit/ip/multicast.cpp index b651b27d..a52bc776 100644 --- a/asio/src/tests/unit/ip/multicast.cpp +++ b/asio/src/tests/unit/ip/multicast.cpp @@ -16,7 +16,7 @@ // Test that header file is self-contained. #include "asio/ip/multicast.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/ip/udp.hpp" #include "../unit_test.hpp" @@ -36,8 +36,8 @@ void test() try { - io_service ios; - ip::udp::socket sock(ios); + io_context ioc; + ip::udp::socket sock(ioc); const ip::address address; const ip::address_v4 address_v4; const ip::address_v6 address_v6; @@ -116,17 +116,17 @@ void test() using namespace asio; namespace ip = asio::ip; - io_service ios; + io_context ioc; asio::error_code ec; ip::udp::endpoint ep_v4(ip::address_v4::loopback(), 0); - ip::udp::socket sock_v4(ios); + ip::udp::socket sock_v4(ioc); sock_v4.open(ep_v4.protocol(), ec); sock_v4.bind(ep_v4, ec); bool have_v4 = !ec; ip::udp::endpoint ep_v6(ip::address_v6::loopback(), 0); - ip::udp::socket sock_v6(ios); + ip::udp::socket sock_v6(ioc); sock_v6.open(ep_v6.protocol(), ec); sock_v6.bind(ep_v6, ec); bool have_v6 = !ec; diff --git a/asio/src/tests/unit/ip/tcp.cpp b/asio/src/tests/unit/ip/tcp.cpp index cec36b73..fde7d229 100644 --- a/asio/src/tests/unit/ip/tcp.cpp +++ b/asio/src/tests/unit/ip/tcp.cpp @@ -20,7 +20,7 @@ #include "asio/ip/tcp.hpp" #include -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/read.hpp" #include "asio/write.hpp" #include "../unit_test.hpp" @@ -57,8 +57,8 @@ void test() try { - io_service ios; - ip::tcp::socket sock(ios); + io_context ioc; + ip::tcp::socket sock(ioc); // no_delay class. @@ -91,8 +91,8 @@ void test() using namespace asio; namespace ip = asio::ip; - io_service ios; - ip::tcp::socket sock(ios, ip::tcp::v4()); + io_context ioc; + ip::tcp::socket sock(ioc, ip::tcp::v4()); asio::error_code ec; // no_delay class. @@ -216,7 +216,7 @@ void test() try { - io_service ios; + io_context ioc; char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; array mutable_buffers = {{ @@ -238,15 +238,15 @@ void test() // basic_stream_socket constructors. - ip::tcp::socket socket1(ios); - ip::tcp::socket socket2(ios, ip::tcp::v4()); - ip::tcp::socket socket3(ios, ip::tcp::v6()); - ip::tcp::socket socket4(ios, ip::tcp::endpoint(ip::tcp::v4(), 0)); - ip::tcp::socket socket5(ios, ip::tcp::endpoint(ip::tcp::v6(), 0)); + ip::tcp::socket socket1(ioc); + ip::tcp::socket socket2(ioc, ip::tcp::v4()); + ip::tcp::socket socket3(ioc, ip::tcp::v6()); + ip::tcp::socket socket4(ioc, ip::tcp::endpoint(ip::tcp::v4(), 0)); + ip::tcp::socket socket5(ioc, ip::tcp::endpoint(ip::tcp::v6(), 0)); #if !defined(ASIO_WINDOWS_RUNTIME) ip::tcp::socket::native_handle_type native_socket1 = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - ip::tcp::socket socket6(ios, ip::tcp::v4(), native_socket1); + ip::tcp::socket socket6(ioc, ip::tcp::v4(), native_socket1); #endif // !defined(ASIO_WINDOWS_RUNTIME) #if defined(ASIO_HAS_MOVE) @@ -256,14 +256,14 @@ void test() // basic_stream_socket operators. #if defined(ASIO_HAS_MOVE) - socket1 = ip::tcp::socket(ios); + socket1 = ip::tcp::socket(ioc); socket1 = std::move(socket2); #endif // defined(ASIO_HAS_MOVE) // basic_io_object functions. - io_service& ios_ref = socket1.get_io_service(); - (void)ios_ref; + io_context& ioc_ref = socket1.get_io_context(); + (void)ioc_ref; ip::tcp::socket::executor_type ex = socket1.get_executor(); (void)ex; @@ -581,14 +581,14 @@ void test() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - io_service ios; + io_context ioc; - ip::tcp::acceptor acceptor(ios, ip::tcp::endpoint(ip::tcp::v4(), 0)); + ip::tcp::acceptor acceptor(ioc, ip::tcp::endpoint(ip::tcp::v4(), 0)); ip::tcp::endpoint server_endpoint = acceptor.local_endpoint(); server_endpoint.address(ip::address_v4::loopback()); - ip::tcp::socket client_side_socket(ios); - ip::tcp::socket server_side_socket(ios); + ip::tcp::socket client_side_socket(ioc); + ip::tcp::socket server_side_socket(ioc); client_side_socket.connect(server_endpoint); acceptor.accept(server_side_socket); @@ -601,7 +601,7 @@ void test() bindns::bind(handle_read_noop, _1, _2, &read_noop_completed)); - ios.run(); + ioc.run(); ASIO_CHECK(read_noop_completed); // No-op write. @@ -612,8 +612,8 @@ void test() bindns::bind(handle_write_noop, _1, _2, &write_noop_completed)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(write_noop_completed); // Read and write to transfer data. @@ -631,8 +631,8 @@ void test() bindns::bind(handle_write, _1, _2, &write_completed)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(read_completed); ASIO_CHECK(write_completed); ASIO_CHECK(memcmp(read_buffer, write_data, sizeof(write_data)) == 0); @@ -645,14 +645,14 @@ void test() bindns::bind(handle_read_cancel, _1, _2, &read_cancel_completed)); - ios.restart(); - ios.poll(); + ioc.restart(); + ioc.poll(); ASIO_CHECK(!read_cancel_completed); server_side_socket.cancel(); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(read_cancel_completed); // A read when the peer closes socket should fail with eof. @@ -665,8 +665,8 @@ void test() server_side_socket.close(); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(read_eof_completed); } @@ -721,8 +721,8 @@ void test() try { - io_service ios; - ip::tcp::socket peer_socket(ios); + io_context ioc; + ip::tcp::socket peer_socket(ioc); ip::tcp::endpoint peer_endpoint; archetypes::settable_socket_option settable_socket_option1; archetypes::settable_socket_option settable_socket_option2; @@ -736,15 +736,15 @@ void test() // basic_socket_acceptor constructors. - ip::tcp::acceptor acceptor1(ios); - ip::tcp::acceptor acceptor2(ios, ip::tcp::v4()); - ip::tcp::acceptor acceptor3(ios, ip::tcp::v6()); - ip::tcp::acceptor acceptor4(ios, ip::tcp::endpoint(ip::tcp::v4(), 0)); - ip::tcp::acceptor acceptor5(ios, ip::tcp::endpoint(ip::tcp::v6(), 0)); + ip::tcp::acceptor acceptor1(ioc); + ip::tcp::acceptor acceptor2(ioc, ip::tcp::v4()); + ip::tcp::acceptor acceptor3(ioc, ip::tcp::v6()); + ip::tcp::acceptor acceptor4(ioc, ip::tcp::endpoint(ip::tcp::v4(), 0)); + ip::tcp::acceptor acceptor5(ioc, ip::tcp::endpoint(ip::tcp::v6(), 0)); #if !defined(ASIO_WINDOWS_RUNTIME) ip::tcp::acceptor::native_handle_type native_acceptor1 = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - ip::tcp::acceptor acceptor6(ios, ip::tcp::v4(), native_acceptor1); + ip::tcp::acceptor acceptor6(ioc, ip::tcp::v4(), native_acceptor1); #endif // !defined(ASIO_WINDOWS_RUNTIME) #if defined(ASIO_HAS_MOVE) @@ -754,14 +754,14 @@ void test() // basic_socket_acceptor operators. #if defined(ASIO_HAS_MOVE) - acceptor1 = ip::tcp::acceptor(ios); + acceptor1 = ip::tcp::acceptor(ioc); acceptor1 = std::move(acceptor2); #endif // defined(ASIO_HAS_MOVE) // basic_io_object functions. - io_service& ios_ref = acceptor1.get_io_service(); - (void)ios_ref; + io_context& ioc_ref = acceptor1.get_io_context(); + (void)ioc_ref; // basic_socket_acceptor functions. @@ -841,9 +841,9 @@ void test() #if defined(ASIO_HAS_MOVE) peer_socket = acceptor1.accept(); - peer_socket = acceptor1.accept(ios); + peer_socket = acceptor1.accept(ioc); peer_socket = acceptor1.accept(peer_endpoint); - peer_socket = acceptor1.accept(ios, peer_endpoint); + peer_socket = acceptor1.accept(ioc, peer_endpoint); (void)peer_socket; #endif // defined(ASIO_HAS_MOVE) @@ -856,9 +856,9 @@ void test() #if defined(ASIO_HAS_MOVE) acceptor1.async_accept(move_accept_handler()); - acceptor1.async_accept(ios, move_accept_handler()); + acceptor1.async_accept(ioc, move_accept_handler()); acceptor1.async_accept(peer_endpoint, move_accept_handler()); - acceptor1.async_accept(ios, peer_endpoint, move_accept_handler()); + acceptor1.async_accept(ioc, peer_endpoint, move_accept_handler()); #endif // defined(ASIO_HAS_MOVE) } catch (std::exception&) @@ -892,14 +892,14 @@ void test() using namespace asio; namespace ip = asio::ip; - io_service ios; + io_context ioc; - ip::tcp::acceptor acceptor(ios, ip::tcp::endpoint(ip::tcp::v4(), 0)); + ip::tcp::acceptor acceptor(ioc, ip::tcp::endpoint(ip::tcp::v4(), 0)); ip::tcp::endpoint server_endpoint = acceptor.local_endpoint(); server_endpoint.address(ip::address_v4::loopback()); - ip::tcp::socket client_side_socket(ios); - ip::tcp::socket server_side_socket(ios); + ip::tcp::socket client_side_socket(ioc); + ip::tcp::socket server_side_socket(ioc); client_side_socket.connect(server_endpoint); acceptor.accept(server_side_socket); @@ -926,7 +926,7 @@ void test() acceptor.async_accept(server_side_socket, &handle_accept); client_side_socket.async_connect(server_endpoint, &handle_connect); - ios.run(); + ioc.run(); client_side_socket.close(); server_side_socket.close(); @@ -934,8 +934,8 @@ void test() acceptor.async_accept(server_side_socket, client_endpoint, &handle_accept); client_side_socket.async_connect(server_endpoint, &handle_connect); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); client_side_local_endpoint = client_side_socket.local_endpoint(); ASIO_CHECK(client_side_local_endpoint.port() == client_endpoint.port()); @@ -975,7 +975,7 @@ void test() try { - io_service ios; + io_context ioc; archetypes::lazy_handler lazy; asio::error_code ec; ip::tcp::resolver::query q(ip::tcp::v4(), "localhost", "0"); @@ -983,12 +983,12 @@ void test() // basic_resolver constructors. - ip::tcp::resolver resolver(ios); + ip::tcp::resolver resolver(ioc); // basic_io_object functions. - io_service& ios_ref = resolver.get_io_service(); - (void)ios_ref; + io_context& ioc_ref = resolver.get_io_context(); + (void)ioc_ref; // basic_resolver functions. diff --git a/asio/src/tests/unit/ip/udp.cpp b/asio/src/tests/unit/ip/udp.cpp index 9ee2f9b0..56c8b6bb 100644 --- a/asio/src/tests/unit/ip/udp.cpp +++ b/asio/src/tests/unit/ip/udp.cpp @@ -17,7 +17,7 @@ #include "asio/ip/udp.hpp" #include -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "../unit_test.hpp" #include "../archetypes/gettable_socket_option.hpp" #include "../archetypes/async_result.hpp" @@ -90,7 +90,7 @@ void test() try { - io_service ios; + io_context ioc; char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; socket_base::message_flags in_flags = 0; @@ -106,15 +106,15 @@ void test() // basic_datagram_socket constructors. - ip::udp::socket socket1(ios); - ip::udp::socket socket2(ios, ip::udp::v4()); - ip::udp::socket socket3(ios, ip::udp::v6()); - ip::udp::socket socket4(ios, ip::udp::endpoint(ip::udp::v4(), 0)); - ip::udp::socket socket5(ios, ip::udp::endpoint(ip::udp::v6(), 0)); + ip::udp::socket socket1(ioc); + ip::udp::socket socket2(ioc, ip::udp::v4()); + ip::udp::socket socket3(ioc, ip::udp::v6()); + ip::udp::socket socket4(ioc, ip::udp::endpoint(ip::udp::v4(), 0)); + ip::udp::socket socket5(ioc, ip::udp::endpoint(ip::udp::v6(), 0)); #if !defined(ASIO_WINDOWS_RUNTIME) ip::udp::socket::native_handle_type native_socket1 = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - ip::udp::socket socket6(ios, ip::udp::v4(), native_socket1); + ip::udp::socket socket6(ioc, ip::udp::v4(), native_socket1); #endif // !defined(ASIO_WINDOWS_RUNTIME) #if defined(ASIO_HAS_MOVE) @@ -124,14 +124,14 @@ void test() // basic_datagram_socket operators. #if defined(ASIO_HAS_MOVE) - socket1 = ip::udp::socket(ios); + socket1 = ip::udp::socket(ioc); socket1 = std::move(socket2); #endif // defined(ASIO_HAS_MOVE) // basic_io_object functions. - io_service& ios_ref = socket1.get_io_service(); - (void)ios_ref; + io_context& ioc_ref = socket1.get_io_context(); + (void)ioc_ref; ip::udp::socket::executor_type ex = socket1.get_executor(); (void)ex; @@ -468,13 +468,13 @@ void test() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - io_service ios; + io_context ioc; - ip::udp::socket s1(ios, ip::udp::endpoint(ip::udp::v4(), 0)); + ip::udp::socket s1(ioc, ip::udp::endpoint(ip::udp::v4(), 0)); ip::udp::endpoint target_endpoint = s1.local_endpoint(); target_endpoint.address(ip::address_v4::loopback()); - ip::udp::socket s2(ios); + ip::udp::socket s2(ioc); s2.open(ip::udp::v4()); s2.bind(ip::udp::endpoint(ip::udp::v4(), 0)); char send_msg[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; @@ -496,7 +496,7 @@ void test() s2.async_receive_from(buffer(recv_msg, sizeof(recv_msg)), sender_endpoint, bindns::bind(handle_recv, sizeof(recv_msg), _1, _2)); - ios.run(); + ioc.run(); ASIO_CHECK(memcmp(send_msg, recv_msg, sizeof(send_msg)) == 0); } @@ -531,7 +531,7 @@ void test() try { - io_service ios; + io_context ioc; archetypes::lazy_handler lazy; asio::error_code ec; ip::udp::resolver::query q(ip::udp::v4(), "localhost", "0"); @@ -539,12 +539,12 @@ void test() // basic_resolver constructors. - ip::udp::resolver resolver(ios); + ip::udp::resolver resolver(ioc); // basic_io_object functions. - io_service& ios_ref = resolver.get_io_service(); - (void)ios_ref; + io_context& ioc_ref = resolver.get_io_context(); + (void)ioc_ref; // basic_resolver functions. diff --git a/asio/src/tests/unit/ip/unicast.cpp b/asio/src/tests/unit/ip/unicast.cpp index 0382d7cb..cdf669b5 100644 --- a/asio/src/tests/unit/ip/unicast.cpp +++ b/asio/src/tests/unit/ip/unicast.cpp @@ -16,7 +16,7 @@ // Test that header file is self-contained. #include "asio/ip/unicast.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/ip/udp.hpp" #include "../unit_test.hpp" @@ -36,8 +36,8 @@ void test() try { - io_service ios; - ip::udp::socket sock(ios); + io_context ioc; + ip::udp::socket sock(ioc); // hops class. @@ -69,17 +69,17 @@ void test() using namespace asio; namespace ip = asio::ip; - io_service ios; + io_context ioc; asio::error_code ec; ip::udp::endpoint ep_v4(ip::address_v4::loopback(), 0); - ip::udp::socket sock_v4(ios); + ip::udp::socket sock_v4(ioc); sock_v4.open(ep_v4.protocol(), ec); sock_v4.bind(ep_v4, ec); bool have_v4 = !ec; ip::udp::endpoint ep_v6(ip::address_v6::loopback(), 0); - ip::udp::socket sock_v6(ios); + ip::udp::socket sock_v6(ioc); sock_v6.open(ep_v6.protocol(), ec); sock_v6.bind(ep_v6, ec); bool have_v6 = !ec; diff --git a/asio/src/tests/unit/ip/v6_only.cpp b/asio/src/tests/unit/ip/v6_only.cpp index ebb9e6e8..de9827fe 100644 --- a/asio/src/tests/unit/ip/v6_only.cpp +++ b/asio/src/tests/unit/ip/v6_only.cpp @@ -16,7 +16,7 @@ // Test that header file is self-contained. #include "asio/ip/v6_only.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/ip/tcp.hpp" #include "asio/ip/udp.hpp" #include "../unit_test.hpp" @@ -37,8 +37,8 @@ void test() try { - io_service ios; - ip::udp::socket sock(ios); + io_context ioc; + ip::udp::socket sock(ioc); // v6_only class. @@ -72,11 +72,11 @@ void test() using namespace asio; namespace ip = asio::ip; - io_service ios; + io_context ioc; asio::error_code ec; ip::tcp::endpoint ep_v6(ip::address_v6::loopback(), 0); - ip::tcp::acceptor acceptor_v6(ios); + ip::tcp::acceptor acceptor_v6(ioc); acceptor_v6.open(ep_v6.protocol(), ec); acceptor_v6.bind(ep_v6, ec); bool have_v6 = !ec; diff --git a/asio/src/tests/unit/is_read_buffered.cpp b/asio/src/tests/unit/is_read_buffered.cpp index a50dce8e..ee234781 100644 --- a/asio/src/tests/unit/is_read_buffered.cpp +++ b/asio/src/tests/unit/is_read_buffered.cpp @@ -18,7 +18,7 @@ #include "asio/buffered_read_stream.hpp" #include "asio/buffered_write_stream.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/ip/tcp.hpp" #include "unit_test.hpp" @@ -27,18 +27,18 @@ using namespace std; // For memcmp, memcpy and memset. class test_stream { public: - typedef asio::io_service io_service_type; + typedef asio::io_context io_context_type; typedef test_stream lowest_layer_type; - test_stream(asio::io_service& io_service) - : io_service_(io_service) + test_stream(asio::io_context& io_context) + : io_context_(io_context) { } - io_service_type& io_service() + io_context_type& io_context() { - return io_service_; + return io_context_; } lowest_layer_type& lowest_layer() @@ -63,7 +63,7 @@ public: void async_write(const Const_Buffers&, Handler handler) { asio::error_code error; - io_service_.post(asio::detail::bind_handler(handler, error, 0)); + io_context_.post(asio::detail::bind_handler(handler, error, 0)); } template @@ -83,11 +83,11 @@ public: void async_read(const Mutable_Buffers&, Handler handler) { asio::error_code error; - io_service_.post(asio::detail::bind_handler(handler, error, 0)); + io_context_.post(asio::detail::bind_handler(handler, error, 0)); } private: - io_service_type& io_service_; + io_context_type& io_context_; }; void is_read_buffered_test() diff --git a/asio/src/tests/unit/is_write_buffered.cpp b/asio/src/tests/unit/is_write_buffered.cpp index be552090..3b26c275 100644 --- a/asio/src/tests/unit/is_write_buffered.cpp +++ b/asio/src/tests/unit/is_write_buffered.cpp @@ -18,7 +18,7 @@ #include "asio/buffered_read_stream.hpp" #include "asio/buffered_write_stream.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/ip/tcp.hpp" #include "unit_test.hpp" @@ -27,18 +27,18 @@ using namespace std; // For memcmp, memcpy and memset. class test_stream { public: - typedef asio::io_service io_service_type; + typedef asio::io_context io_context_type; typedef test_stream lowest_layer_type; - test_stream(asio::io_service& io_service) - : io_service_(io_service) + test_stream(asio::io_context& io_context) + : io_context_(io_context) { } - io_service_type& io_service() + io_context_type& io_context() { - return io_service_; + return io_context_; } lowest_layer_type& lowest_layer() @@ -63,7 +63,7 @@ public: void async_write(const Const_Buffers&, Handler handler) { asio::error_code error; - io_service_.post(asio::detail::bind_handler(handler, error, 0)); + io_context_.post(asio::detail::bind_handler(handler, error, 0)); } template @@ -83,11 +83,11 @@ public: void async_read(const Mutable_Buffers&, Handler handler) { asio::error_code error; - io_service_.post(asio::detail::bind_handler(handler, error, 0)); + io_context_.post(asio::detail::bind_handler(handler, error, 0)); } private: - io_service_type& io_service_; + io_context_type& io_context_; }; void is_write_buffered_test() diff --git a/asio/src/tests/unit/local/connect_pair.cpp b/asio/src/tests/unit/local/connect_pair.cpp index 6b858395..b1be11b5 100644 --- a/asio/src/tests/unit/local/connect_pair.cpp +++ b/asio/src/tests/unit/local/connect_pair.cpp @@ -16,7 +16,7 @@ // Test that header file is self-contained. #include "asio/local/connect_pair.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/local/datagram_protocol.hpp" #include "asio/local/stream_protocol.hpp" #include "../unit_test.hpp" @@ -40,24 +40,24 @@ void test() try { - asio::io_service io_service; + asio::io_context io_context; asio::error_code ec1; asio::error_code ec2; - dp::socket s1(io_service); - dp::socket s2(io_service); + dp::socket s1(io_context); + dp::socket s2(io_context); local::connect_pair(s1, s2); - dp::socket s3(io_service); - dp::socket s4(io_service); + dp::socket s3(io_context); + dp::socket s4(io_context); ec1 = local::connect_pair(s3, s4, ec2); - sp::socket s5(io_service); - sp::socket s6(io_service); + sp::socket s5(io_context); + sp::socket s6(io_context); local::connect_pair(s5, s6); - sp::socket s7(io_service); - sp::socket s8(io_service); + sp::socket s7(io_context); + sp::socket s8(io_context); ec1 = local::connect_pair(s7, s8, ec2); } catch (std::exception&) diff --git a/asio/src/tests/unit/local/datagram_protocol.cpp b/asio/src/tests/unit/local/datagram_protocol.cpp index 5c1839a1..98446abc 100644 --- a/asio/src/tests/unit/local/datagram_protocol.cpp +++ b/asio/src/tests/unit/local/datagram_protocol.cpp @@ -17,7 +17,7 @@ #include "asio/local/datagram_protocol.hpp" #include -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "../unit_test.hpp" //------------------------------------------------------------------------------ @@ -51,7 +51,7 @@ void test() try { - io_service ios; + io_context ioc; char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; socket_base::message_flags in_flags = 0; @@ -61,16 +61,16 @@ void test() // basic_datagram_socket constructors. - dp::socket socket1(ios); - dp::socket socket2(ios, dp()); - dp::socket socket3(ios, dp::endpoint("")); + dp::socket socket1(ioc); + dp::socket socket2(ioc, dp()); + dp::socket socket3(ioc, dp::endpoint("")); int native_socket1 = ::socket(AF_UNIX, SOCK_DGRAM, 0); - dp::socket socket4(ios, dp(), native_socket1); + dp::socket socket4(ioc, dp(), native_socket1); // basic_io_object functions. - io_service& ios_ref = socket1.get_io_service(); - (void)ios_ref; + io_context& ioc_ref = socket1.get_io_context(); + (void)ioc_ref; // basic_socket functions. diff --git a/asio/src/tests/unit/local/stream_protocol.cpp b/asio/src/tests/unit/local/stream_protocol.cpp index b0725dda..b8d3ff87 100644 --- a/asio/src/tests/unit/local/stream_protocol.cpp +++ b/asio/src/tests/unit/local/stream_protocol.cpp @@ -17,7 +17,7 @@ #include "asio/local/stream_protocol.hpp" #include -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "../unit_test.hpp" //------------------------------------------------------------------------------ @@ -59,7 +59,7 @@ void test() try { - io_service ios; + io_context ioc; char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; socket_base::message_flags in_flags = 0; @@ -69,16 +69,16 @@ void test() // basic_stream_socket constructors. - sp::socket socket1(ios); - sp::socket socket2(ios, sp()); - sp::socket socket3(ios, sp::endpoint("")); + sp::socket socket1(ioc); + sp::socket socket2(ioc, sp()); + sp::socket socket3(ioc, sp::endpoint("")); int native_socket1 = ::socket(AF_UNIX, SOCK_STREAM, 0); - sp::socket socket4(ios, sp(), native_socket1); + sp::socket socket4(ioc, sp(), native_socket1); // basic_io_object functions. - io_service& ios_ref = socket1.get_io_service(); - (void)ios_ref; + io_context& ioc_ref = socket1.get_io_context(); + (void)ioc_ref; // basic_socket functions. diff --git a/asio/src/tests/unit/posix/stream_descriptor.cpp b/asio/src/tests/unit/posix/stream_descriptor.cpp index 24a5410e..ce1c9efa 100644 --- a/asio/src/tests/unit/posix/stream_descriptor.cpp +++ b/asio/src/tests/unit/posix/stream_descriptor.cpp @@ -16,7 +16,7 @@ // Test that header file is self-contained. #include "asio/posix/stream_descriptor.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "../archetypes/async_result.hpp" #include "../unit_test.hpp" @@ -50,7 +50,7 @@ void test() try { - io_service ios; + io_context ioc; char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; posix::descriptor_base::bytes_readable io_control_command; @@ -59,9 +59,9 @@ void test() // basic_stream_descriptor constructors. - posix::stream_descriptor descriptor1(ios); + posix::stream_descriptor descriptor1(ioc); int native_descriptor1 = -1; - posix::stream_descriptor descriptor2(ios, native_descriptor1); + posix::stream_descriptor descriptor2(ioc, native_descriptor1); #if defined(ASIO_HAS_MOVE) posix::stream_descriptor descriptor3(std::move(descriptor2)); @@ -70,14 +70,14 @@ void test() // basic_stream_descriptor operators. #if defined(ASIO_HAS_MOVE) - descriptor1 = posix::stream_descriptor(ios); + descriptor1 = posix::stream_descriptor(ioc); descriptor1 = std::move(descriptor2); #endif // defined(ASIO_HAS_MOVE) // basic_io_object functions. - io_service& ios_ref = descriptor1.get_io_service(); - (void)ios_ref; + io_context& ioc_ref = descriptor1.get_io_context(); + (void)ioc_ref; // basic_descriptor functions. diff --git a/asio/src/tests/unit/read.cpp b/asio/src/tests/unit/read.cpp index 06b2cb87..872d1116 100644 --- a/asio/src/tests/unit/read.cpp +++ b/asio/src/tests/unit/read.cpp @@ -19,7 +19,7 @@ #include #include #include "archetypes/async_result.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/post.hpp" #include "asio/streambuf.hpp" #include "unit_test.hpp" @@ -43,10 +43,10 @@ using namespace std; // For memcmp, memcpy and memset. class test_stream { public: - typedef asio::io_service::executor_type executor_type; + typedef asio::io_context::executor_type executor_type; - test_stream(asio::io_service& io_service) - : io_service_(io_service), + test_stream(asio::io_context& io_context) + : io_context_(io_context), length_(0), position_(0), next_read_length_(0) @@ -55,7 +55,7 @@ public: executor_type get_executor() ASIO_NOEXCEPT { - return io_service_.get_executor(); + return io_context_.get_executor(); } void reset(const void* data, size_t length) @@ -125,7 +125,7 @@ public: } private: - asio::io_service& io_service_; + asio::io_context& io_context_; enum { max_length = 8192 }; char data_[max_length]; size_t length_; @@ -138,8 +138,8 @@ static const char read_data[] void test_2_arg_zero_buffers_read() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); std::vector buffers; size_t bytes_transferred = asio::read(s, buffers); @@ -148,8 +148,8 @@ void test_2_arg_zero_buffers_read() void test_2_arg_mutable_buffers_1_read() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); char read_buf[sizeof(read_data)]; asio::mutable_buffers_1 buffers = asio::buffer(read_buf, sizeof(read_buf)); @@ -177,8 +177,8 @@ void test_2_arg_mutable_buffers_1_read() void test_2_arg_vector_buffers_read() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); char read_buf[sizeof(read_data)]; std::vector buffers; buffers.push_back(asio::buffer(read_buf, 32)); @@ -207,8 +207,8 @@ void test_2_arg_vector_buffers_read() void test_2_arg_streambuf_read() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); asio::streambuf sb(sizeof(read_data)); s.reset(read_data, sizeof(read_data)); @@ -237,8 +237,8 @@ void test_2_arg_streambuf_read() void test_3_arg_nothrow_zero_buffers_read() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); std::vector buffers; asio::error_code error; @@ -249,8 +249,8 @@ void test_3_arg_nothrow_zero_buffers_read() void test_3_arg_nothrow_mutable_buffers_1_read() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); char read_buf[sizeof(read_data)]; asio::mutable_buffers_1 buffers = asio::buffer(read_buf, sizeof(read_buf)); @@ -282,8 +282,8 @@ void test_3_arg_nothrow_mutable_buffers_1_read() void test_3_arg_nothrow_vector_buffers_read() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); char read_buf[sizeof(read_data)]; std::vector buffers; buffers.push_back(asio::buffer(read_buf, 32)); @@ -316,8 +316,8 @@ void test_3_arg_nothrow_vector_buffers_read() void test_3_arg_nothrow_streambuf_read() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); asio::streambuf sb(sizeof(read_data)); s.reset(read_data, sizeof(read_data)); @@ -362,8 +362,8 @@ size_t short_transfer(const asio::error_code& ec, void test_3_arg_mutable_buffers_1_read() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); char read_buf[sizeof(read_data)]; asio::mutable_buffers_1 buffers = asio::buffer(read_buf, sizeof(read_buf)); @@ -572,8 +572,8 @@ void test_3_arg_mutable_buffers_1_read() void test_3_arg_vector_buffers_read() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); char read_buf[sizeof(read_data)]; std::vector buffers; buffers.push_back(asio::buffer(read_buf, 32)); @@ -783,8 +783,8 @@ void test_3_arg_vector_buffers_read() void test_3_arg_streambuf_read() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); asio::streambuf sb(sizeof(read_data)); s.reset(read_data, sizeof(read_data)); @@ -1018,8 +1018,8 @@ void test_3_arg_streambuf_read() void test_4_arg_mutable_buffers_1_read() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); char read_buf[sizeof(read_data)]; asio::mutable_buffers_1 buffers = asio::buffer(read_buf, sizeof(read_buf)); @@ -1283,8 +1283,8 @@ void test_4_arg_mutable_buffers_1_read() void test_4_arg_vector_buffers_read() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); char read_buf[sizeof(read_data)]; std::vector buffers; buffers.push_back(asio::buffer(read_buf, 32)); @@ -1549,8 +1549,8 @@ void test_4_arg_vector_buffers_read() void test_4_arg_streambuf_read() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); asio::streambuf sb(sizeof(read_data)); s.reset(read_data, sizeof(read_data)); @@ -1855,8 +1855,8 @@ void test_3_arg_mutable_buffers_1_async_read() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); char read_buf[sizeof(read_data)]; asio::mutable_buffers_1 buffers = asio::buffer(read_buf, sizeof(read_buf)); @@ -1867,8 +1867,8 @@ void test_3_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -1879,8 +1879,8 @@ void test_3_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -1891,8 +1891,8 @@ void test_3_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -1900,8 +1900,8 @@ void test_3_arg_mutable_buffers_1_async_read() memset(read_buf, 0, sizeof(read_buf)); int i = asio::async_read(s, buffers, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); } @@ -1916,8 +1916,8 @@ void test_3_arg_boost_array_buffers_async_read() #endif // defined(ASIO_HAS_BOOST_BIND) #if defined(ASIO_HAS_BOOST_ARRAY) - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); char read_buf[sizeof(read_data)]; boost::array buffers = { { asio::buffer(read_buf, 32), @@ -1929,8 +1929,8 @@ void test_3_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -1941,8 +1941,8 @@ void test_3_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -1953,8 +1953,8 @@ void test_3_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -1962,8 +1962,8 @@ void test_3_arg_boost_array_buffers_async_read() memset(read_buf, 0, sizeof(read_buf)); int i = asio::async_read(s, buffers, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); #endif // defined(ASIO_HAS_BOOST_ARRAY) } @@ -1979,8 +1979,8 @@ void test_3_arg_std_array_buffers_async_read() #endif // defined(ASIO_HAS_BOOST_BIND) #if defined(ASIO_HAS_STD_ARRAY) - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); char read_buf[sizeof(read_data)]; std::array buffers = { { asio::buffer(read_buf, 32), @@ -1992,8 +1992,8 @@ void test_3_arg_std_array_buffers_async_read() asio::async_read(s, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2004,8 +2004,8 @@ void test_3_arg_std_array_buffers_async_read() asio::async_read(s, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2016,8 +2016,8 @@ void test_3_arg_std_array_buffers_async_read() asio::async_read(s, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2025,8 +2025,8 @@ void test_3_arg_std_array_buffers_async_read() memset(read_buf, 0, sizeof(read_buf)); int i = asio::async_read(s, buffers, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); #endif // defined(ASIO_HAS_STD_ARRAY) } @@ -2041,8 +2041,8 @@ void test_3_arg_vector_buffers_async_read() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); char read_buf[sizeof(read_data)]; std::vector buffers; buffers.push_back(asio::buffer(read_buf, 32)); @@ -2054,8 +2054,8 @@ void test_3_arg_vector_buffers_async_read() asio::async_read(s, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2066,8 +2066,8 @@ void test_3_arg_vector_buffers_async_read() asio::async_read(s, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2078,8 +2078,8 @@ void test_3_arg_vector_buffers_async_read() asio::async_read(s, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2087,8 +2087,8 @@ void test_3_arg_vector_buffers_async_read() memset(read_buf, 0, sizeof(read_buf)); int i = asio::async_read(s, buffers, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); } @@ -2102,8 +2102,8 @@ void test_3_arg_streambuf_async_read() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); asio::streambuf sb(sizeof(read_data)); s.reset(read_data, sizeof(read_data)); @@ -2112,8 +2112,8 @@ void test_3_arg_streambuf_async_read() asio::async_read(s, sb, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(sb.data(), sizeof(read_data))); @@ -2125,8 +2125,8 @@ void test_3_arg_streambuf_async_read() asio::async_read(s, sb, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(sb.data(), sizeof(read_data))); @@ -2138,8 +2138,8 @@ void test_3_arg_streambuf_async_read() asio::async_read(s, sb, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(sb.data(), sizeof(read_data))); @@ -2148,8 +2148,8 @@ void test_3_arg_streambuf_async_read() sb.consume(sb.size()); int i = asio::async_read(s, sb, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(sb.data(), sizeof(read_data))); } @@ -2164,8 +2164,8 @@ void test_4_arg_mutable_buffers_1_async_read() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); char read_buf[sizeof(read_data)]; asio::mutable_buffers_1 buffers = asio::buffer(read_buf, sizeof(read_buf)); @@ -2176,8 +2176,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2188,8 +2188,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2200,8 +2200,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2211,8 +2211,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2223,8 +2223,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -2235,8 +2235,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2246,8 +2246,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2258,8 +2258,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2270,8 +2270,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2281,8 +2281,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2293,8 +2293,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -2305,8 +2305,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 50)); @@ -2316,8 +2316,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -2328,8 +2328,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -2340,8 +2340,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -2351,8 +2351,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2363,8 +2363,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2375,8 +2375,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2386,8 +2386,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -2398,8 +2398,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -2410,8 +2410,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -2421,8 +2421,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2433,8 +2433,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2445,8 +2445,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2456,8 +2456,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2468,8 +2468,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2480,8 +2480,8 @@ void test_4_arg_mutable_buffers_1_async_read() asio::async_read(s, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2490,8 +2490,8 @@ void test_4_arg_mutable_buffers_1_async_read() int i = asio::async_read(s, buffers, short_transfer, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); } @@ -2506,8 +2506,8 @@ void test_4_arg_boost_array_buffers_async_read() #endif // defined(ASIO_HAS_BOOST_BIND) #if defined(ASIO_HAS_BOOST_ARRAY) - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); char read_buf[sizeof(read_data)]; boost::array buffers = { { asio::buffer(read_buf, 32), @@ -2519,8 +2519,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2531,8 +2531,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2543,8 +2543,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2554,8 +2554,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2566,8 +2566,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -2578,8 +2578,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2589,8 +2589,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2601,8 +2601,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2613,8 +2613,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2624,8 +2624,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2636,8 +2636,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -2648,8 +2648,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 50)); @@ -2659,8 +2659,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -2671,8 +2671,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -2683,8 +2683,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -2694,8 +2694,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2706,8 +2706,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2718,8 +2718,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2729,8 +2729,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -2741,8 +2741,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -2753,8 +2753,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -2764,8 +2764,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2776,8 +2776,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2788,8 +2788,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2799,8 +2799,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2811,8 +2811,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2823,8 +2823,8 @@ void test_4_arg_boost_array_buffers_async_read() asio::async_read(s, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2833,8 +2833,8 @@ void test_4_arg_boost_array_buffers_async_read() int i = asio::async_read(s, buffers, short_transfer, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); #endif // defined(ASIO_HAS_BOOST_ARRAY) } @@ -2850,8 +2850,8 @@ void test_4_arg_std_array_buffers_async_read() #endif // defined(ASIO_HAS_BOOST_BIND) #if defined(ASIO_HAS_STD_ARRAY) - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); char read_buf[sizeof(read_data)]; std::array buffers = { { asio::buffer(read_buf, 32), @@ -2863,8 +2863,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2875,8 +2875,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2887,8 +2887,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2898,8 +2898,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2910,8 +2910,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -2922,8 +2922,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2933,8 +2933,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2945,8 +2945,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2957,8 +2957,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2968,8 +2968,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -2980,8 +2980,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -2992,8 +2992,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 50)); @@ -3003,8 +3003,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -3015,8 +3015,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -3027,8 +3027,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -3038,8 +3038,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -3050,8 +3050,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -3062,8 +3062,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -3073,8 +3073,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -3085,8 +3085,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -3097,8 +3097,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -3108,8 +3108,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -3120,8 +3120,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -3132,8 +3132,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -3143,8 +3143,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -3155,8 +3155,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -3167,8 +3167,8 @@ void test_4_arg_std_array_buffers_async_read() asio::async_read(s, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -3177,8 +3177,8 @@ void test_4_arg_std_array_buffers_async_read() int i = asio::async_read(s, buffers, short_transfer, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); #endif // defined(ASIO_HAS_STD_ARRAY) } @@ -3193,8 +3193,8 @@ void test_4_arg_vector_buffers_async_read() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); char read_buf[sizeof(read_data)]; std::vector buffers; buffers.push_back(asio::buffer(read_buf, 32)); @@ -3206,8 +3206,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -3218,8 +3218,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -3230,8 +3230,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -3241,8 +3241,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -3253,8 +3253,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -3265,8 +3265,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -3276,8 +3276,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -3288,8 +3288,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -3300,8 +3300,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -3311,8 +3311,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -3323,8 +3323,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -3335,8 +3335,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 50)); @@ -3346,8 +3346,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -3358,8 +3358,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -3370,8 +3370,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -3381,8 +3381,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -3393,8 +3393,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -3405,8 +3405,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -3416,8 +3416,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -3428,8 +3428,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -3440,8 +3440,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -3451,8 +3451,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -3463,8 +3463,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -3475,8 +3475,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -3486,8 +3486,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -3498,8 +3498,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -3510,8 +3510,8 @@ void test_4_arg_vector_buffers_async_read() asio::async_read(s, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); @@ -3520,8 +3520,8 @@ void test_4_arg_vector_buffers_async_read() int i = asio::async_read(s, buffers, short_transfer, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(buffers, sizeof(read_data))); } @@ -3535,8 +3535,8 @@ void test_4_arg_streambuf_async_read() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); asio::streambuf sb(sizeof(read_data)); s.reset(read_data, sizeof(read_data)); @@ -3545,8 +3545,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(sb.data(), sizeof(read_data))); @@ -3558,8 +3558,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(sb.data(), sizeof(read_data))); @@ -3571,8 +3571,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(sb.data(), sizeof(read_data))); @@ -3583,8 +3583,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(sb.data(), sizeof(read_data))); @@ -3596,8 +3596,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 1); ASIO_CHECK(s.check_buffers(sb.data(), 1)); @@ -3609,8 +3609,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 10); ASIO_CHECK(s.check_buffers(sb.data(), 10)); @@ -3621,8 +3621,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(sb.data(), sizeof(read_data))); @@ -3634,8 +3634,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 10); ASIO_CHECK(s.check_buffers(sb.data(), 10)); @@ -3647,8 +3647,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 10); ASIO_CHECK(s.check_buffers(sb.data(), 10)); @@ -3659,8 +3659,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(sb.data(), sizeof(read_data))); @@ -3672,8 +3672,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 42); ASIO_CHECK(s.check_buffers(sb.data(), 42)); @@ -3685,8 +3685,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 50); ASIO_CHECK(s.check_buffers(sb.data(), 50)); @@ -3697,8 +3697,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 1); ASIO_CHECK(s.check_buffers(sb.data(), 1)); @@ -3710,8 +3710,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 1); ASIO_CHECK(s.check_buffers(sb.data(), 1)); @@ -3723,8 +3723,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 1); ASIO_CHECK(s.check_buffers(sb.data(), 1)); @@ -3735,8 +3735,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 10); ASIO_CHECK(s.check_buffers(sb.data(), 10)); @@ -3748,8 +3748,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 10); ASIO_CHECK(s.check_buffers(sb.data(), 10)); @@ -3761,8 +3761,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 10); ASIO_CHECK(s.check_buffers(sb.data(), 10)); @@ -3773,8 +3773,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 42); ASIO_CHECK(s.check_buffers(sb.data(), 42)); @@ -3786,8 +3786,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 42); ASIO_CHECK(s.check_buffers(sb.data(), 42)); @@ -3799,8 +3799,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 42); ASIO_CHECK(s.check_buffers(sb.data(), 42)); @@ -3811,8 +3811,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(sb.data(), sizeof(read_data))); @@ -3824,8 +3824,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(sb.data(), sizeof(read_data))); @@ -3837,8 +3837,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(sb.data(), sizeof(read_data))); @@ -3849,8 +3849,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(sb.data(), sizeof(read_data))); @@ -3862,8 +3862,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(sb.data(), sizeof(read_data))); @@ -3875,8 +3875,8 @@ void test_4_arg_streambuf_async_read() asio::async_read(s, sb, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(sb.data(), sizeof(read_data))); @@ -3886,8 +3886,8 @@ void test_4_arg_streambuf_async_read() int i = asio::async_read(s, sb, short_transfer, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(sb.data(), sizeof(read_data))); } diff --git a/asio/src/tests/unit/read_at.cpp b/asio/src/tests/unit/read_at.cpp index 1649585d..fec97160 100644 --- a/asio/src/tests/unit/read_at.cpp +++ b/asio/src/tests/unit/read_at.cpp @@ -18,7 +18,7 @@ #include #include "archetypes/async_result.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/post.hpp" #include "asio/streambuf.hpp" #include "unit_test.hpp" @@ -42,10 +42,10 @@ using namespace std; // For memcmp, memcpy and memset. class test_random_access_device { public: - typedef asio::io_service::executor_type executor_type; + typedef asio::io_context::executor_type executor_type; - test_random_access_device(asio::io_service& io_service) - : io_service_(io_service), + test_random_access_device(asio::io_context& io_context) + : io_context_(io_context), length_(0), next_read_length_(0) { @@ -53,7 +53,7 @@ public: executor_type get_executor() ASIO_NOEXCEPT { - return io_service_.get_executor(); + return io_context_.get_executor(); } void reset(const void* data, size_t length) @@ -128,7 +128,7 @@ public: } private: - asio::io_service& io_service_; + asio::io_context& io_context_; enum { max_length = 8192 }; char data_[max_length]; size_t length_; @@ -140,8 +140,8 @@ static const char read_data[] void test_3_arg_mutable_buffers_1_read_at() { - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; asio::mutable_buffers_1 buffers = asio::buffer(read_buf, sizeof(read_buf)); @@ -189,8 +189,8 @@ void test_3_arg_mutable_buffers_1_read_at() void test_3_arg_vector_buffers_read_at() { - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; std::vector buffers; buffers.push_back(asio::buffer(read_buf, 32)); @@ -239,8 +239,8 @@ void test_3_arg_vector_buffers_read_at() void test_3_arg_streambuf_read_at() { - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); asio::streambuf sb(sizeof(read_data)); s.reset(read_data, sizeof(read_data)); @@ -292,8 +292,8 @@ void test_3_arg_streambuf_read_at() void test_4_arg_nothrow_mutable_buffers_1_read_at() { - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; asio::mutable_buffers_1 buffers = asio::buffer(read_buf, sizeof(read_buf)); @@ -348,8 +348,8 @@ void test_4_arg_nothrow_mutable_buffers_1_read_at() void test_4_arg_nothrow_vector_buffers_read_at() { - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; std::vector buffers; buffers.push_back(asio::buffer(read_buf, 32)); @@ -405,8 +405,8 @@ void test_4_arg_nothrow_vector_buffers_read_at() void test_4_arg_nothrow_streambuf_read_at() { - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); asio::streambuf sb(sizeof(read_data)); s.reset(read_data, sizeof(read_data)); @@ -477,8 +477,8 @@ size_t short_transfer(const asio::error_code& ec, void test_4_arg_mutable_buffers_1_read_at() { - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; asio::mutable_buffers_1 buffers = asio::buffer(read_buf, sizeof(read_buf)); @@ -894,8 +894,8 @@ void test_4_arg_mutable_buffers_1_read_at() void test_4_arg_vector_buffers_read_at() { - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; std::vector buffers; buffers.push_back(asio::buffer(read_buf, 32)); @@ -1312,8 +1312,8 @@ void test_4_arg_vector_buffers_read_at() void test_4_arg_streambuf_read_at() { - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); asio::streambuf sb(sizeof(read_data)); s.reset(read_data, sizeof(read_data)); @@ -1781,8 +1781,8 @@ void test_4_arg_streambuf_read_at() void test_5_arg_mutable_buffers_1_read_at() { - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; asio::mutable_buffers_1 buffers = asio::buffer(read_buf, sizeof(read_buf)); @@ -2307,8 +2307,8 @@ void test_5_arg_mutable_buffers_1_read_at() void test_5_arg_vector_buffers_read_at() { - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; std::vector buffers; buffers.push_back(asio::buffer(read_buf, 32)); @@ -2834,8 +2834,8 @@ void test_5_arg_vector_buffers_read_at() void test_5_arg_streambuf_read_at() { - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); asio::streambuf sb(sizeof(read_data)); s.reset(read_data, sizeof(read_data)); @@ -3428,8 +3428,8 @@ void test_4_arg_mutable_buffers_1_async_read_at() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; asio::mutable_buffers_1 buffers = asio::buffer(read_buf, sizeof(read_buf)); @@ -3440,8 +3440,8 @@ void test_4_arg_mutable_buffers_1_async_read_at() asio::async_read_at(s, 0, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -3451,8 +3451,8 @@ void test_4_arg_mutable_buffers_1_async_read_at() asio::async_read_at(s, 1234, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -3463,8 +3463,8 @@ void test_4_arg_mutable_buffers_1_async_read_at() asio::async_read_at(s, 0, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -3475,8 +3475,8 @@ void test_4_arg_mutable_buffers_1_async_read_at() asio::async_read_at(s, 1234, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -3487,8 +3487,8 @@ void test_4_arg_mutable_buffers_1_async_read_at() asio::async_read_at(s, 0, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -3499,8 +3499,8 @@ void test_4_arg_mutable_buffers_1_async_read_at() asio::async_read_at(s, 1234, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -3509,8 +3509,8 @@ void test_4_arg_mutable_buffers_1_async_read_at() int i = asio::async_read_at(s, 1234, buffers, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); } @@ -3525,8 +3525,8 @@ void test_4_arg_boost_array_buffers_async_read_at() #endif // defined(ASIO_HAS_BOOST_BIND) #if defined(ASIO_HAS_BOOST_ARRAY) - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; boost::array buffers = { { asio::buffer(read_buf, 32), @@ -3538,8 +3538,8 @@ void test_4_arg_boost_array_buffers_async_read_at() asio::async_read_at(s, 0, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -3549,8 +3549,8 @@ void test_4_arg_boost_array_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -3561,8 +3561,8 @@ void test_4_arg_boost_array_buffers_async_read_at() asio::async_read_at(s, 0, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -3573,8 +3573,8 @@ void test_4_arg_boost_array_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -3585,8 +3585,8 @@ void test_4_arg_boost_array_buffers_async_read_at() asio::async_read_at(s, 0, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -3597,8 +3597,8 @@ void test_4_arg_boost_array_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -3607,8 +3607,8 @@ void test_4_arg_boost_array_buffers_async_read_at() int i = asio::async_read_at(s, 1234, buffers, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); #endif // defined(ASIO_HAS_BOOST_ARRAY) } @@ -3624,8 +3624,8 @@ void test_4_arg_std_array_buffers_async_read_at() #endif // defined(ASIO_HAS_BOOST_BIND) #if defined(ASIO_HAS_STD_ARRAY) - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; std::array buffers = { { asio::buffer(read_buf, 32), @@ -3637,8 +3637,8 @@ void test_4_arg_std_array_buffers_async_read_at() asio::async_read_at(s, 0, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -3648,8 +3648,8 @@ void test_4_arg_std_array_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -3660,8 +3660,8 @@ void test_4_arg_std_array_buffers_async_read_at() asio::async_read_at(s, 0, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -3672,8 +3672,8 @@ void test_4_arg_std_array_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -3684,8 +3684,8 @@ void test_4_arg_std_array_buffers_async_read_at() asio::async_read_at(s, 0, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -3696,8 +3696,8 @@ void test_4_arg_std_array_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -3706,8 +3706,8 @@ void test_4_arg_std_array_buffers_async_read_at() int i = asio::async_read_at(s, 1234, buffers, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); #endif // defined(ASIO_HAS_STD_ARRAY) } @@ -3722,8 +3722,8 @@ void test_4_arg_vector_buffers_async_read_at() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; std::vector buffers; buffers.push_back(asio::buffer(read_buf, 32)); @@ -3735,8 +3735,8 @@ void test_4_arg_vector_buffers_async_read_at() asio::async_read_at(s, 0, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -3746,8 +3746,8 @@ void test_4_arg_vector_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -3758,8 +3758,8 @@ void test_4_arg_vector_buffers_async_read_at() asio::async_read_at(s, 0, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -3770,8 +3770,8 @@ void test_4_arg_vector_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -3782,8 +3782,8 @@ void test_4_arg_vector_buffers_async_read_at() asio::async_read_at(s, 0, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -3794,8 +3794,8 @@ void test_4_arg_vector_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -3804,8 +3804,8 @@ void test_4_arg_vector_buffers_async_read_at() int i = asio::async_read_at(s, 1234, buffers, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); } @@ -3819,8 +3819,8 @@ void test_4_arg_streambuf_async_read_at() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); asio::streambuf sb(sizeof(read_data)); s.reset(read_data, sizeof(read_data)); @@ -3829,8 +3829,8 @@ void test_4_arg_streambuf_async_read_at() asio::async_read_at(s, 0, sb, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); @@ -3841,8 +3841,8 @@ void test_4_arg_streambuf_async_read_at() asio::async_read_at(s, 1234, sb, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); @@ -3854,8 +3854,8 @@ void test_4_arg_streambuf_async_read_at() asio::async_read_at(s, 0, sb, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); @@ -3867,8 +3867,8 @@ void test_4_arg_streambuf_async_read_at() asio::async_read_at(s, 1234, sb, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); @@ -3880,8 +3880,8 @@ void test_4_arg_streambuf_async_read_at() asio::async_read_at(s, 0, sb, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); @@ -3893,8 +3893,8 @@ void test_4_arg_streambuf_async_read_at() asio::async_read_at(s, 1234, sb, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); @@ -3904,8 +3904,8 @@ void test_4_arg_streambuf_async_read_at() int i = asio::async_read_at(s, 1234, sb, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); } @@ -3919,8 +3919,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; asio::mutable_buffers_1 buffers = asio::buffer(read_buf, sizeof(read_buf)); @@ -3932,8 +3932,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -3944,8 +3944,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -3957,8 +3957,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -3970,8 +3970,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -3983,8 +3983,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -3996,8 +3996,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -4008,8 +4008,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -4020,8 +4020,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -4033,8 +4033,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -4046,8 +4046,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -4059,8 +4059,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -4072,8 +4072,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -4084,8 +4084,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -4096,8 +4096,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -4109,8 +4109,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -4122,8 +4122,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -4135,8 +4135,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -4148,8 +4148,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -4160,8 +4160,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -4172,8 +4172,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -4185,8 +4185,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -4198,8 +4198,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -4211,8 +4211,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 50)); @@ -4224,8 +4224,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 50)); @@ -4236,8 +4236,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -4248,8 +4248,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -4261,8 +4261,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -4274,8 +4274,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -4287,8 +4287,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -4300,8 +4300,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -4312,8 +4312,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -4324,8 +4324,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -4337,8 +4337,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -4350,8 +4350,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -4363,8 +4363,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -4376,8 +4376,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -4388,8 +4388,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -4400,8 +4400,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -4413,8 +4413,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -4426,8 +4426,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -4439,8 +4439,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -4452,8 +4452,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -4463,8 +4463,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::async_read_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -4474,8 +4474,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::async_read_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -4486,8 +4486,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::async_read_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -4498,8 +4498,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::async_read_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -4510,8 +4510,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::async_read_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -4522,8 +4522,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::async_read_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -4533,8 +4533,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::async_read_at(s, 0, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -4544,8 +4544,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::async_read_at(s, 1234, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -4556,8 +4556,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::async_read_at(s, 0, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -4568,8 +4568,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::async_read_at(s, 1234, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -4580,8 +4580,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::async_read_at(s, 0, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -4592,8 +4592,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() asio::async_read_at(s, 1234, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -4602,8 +4602,8 @@ void test_5_arg_mutable_buffers_1_async_read_at() int i = asio::async_read_at(s, 1234, buffers, short_transfer, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); } @@ -4618,8 +4618,8 @@ void test_5_arg_boost_array_buffers_async_read_at() #endif // defined(ASIO_HAS_BOOST_BIND) #if defined(ASIO_HAS_BOOST_ARRAY) - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; boost::array buffers = { { asio::buffer(read_buf, 32), @@ -4632,8 +4632,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -4644,8 +4644,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -4657,8 +4657,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -4670,8 +4670,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -4683,8 +4683,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -4696,8 +4696,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -4708,8 +4708,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -4720,8 +4720,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -4733,8 +4733,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -4746,8 +4746,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -4759,8 +4759,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -4772,8 +4772,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -4784,8 +4784,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -4796,8 +4796,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -4809,8 +4809,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -4822,8 +4822,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -4835,8 +4835,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -4848,8 +4848,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -4860,8 +4860,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -4872,8 +4872,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -4885,8 +4885,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -4898,8 +4898,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -4911,8 +4911,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 50)); @@ -4924,8 +4924,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 50)); @@ -4936,8 +4936,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -4948,8 +4948,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -4961,8 +4961,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -4974,8 +4974,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -4987,8 +4987,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -5000,8 +5000,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -5012,8 +5012,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -5024,8 +5024,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -5037,8 +5037,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -5050,8 +5050,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -5063,8 +5063,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -5076,8 +5076,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -5088,8 +5088,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -5100,8 +5100,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -5113,8 +5113,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -5126,8 +5126,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -5139,8 +5139,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -5152,8 +5152,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -5163,8 +5163,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::async_read_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -5174,8 +5174,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -5186,8 +5186,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::async_read_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -5198,8 +5198,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -5210,8 +5210,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::async_read_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -5222,8 +5222,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -5233,8 +5233,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::async_read_at(s, 0, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -5244,8 +5244,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -5256,8 +5256,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::async_read_at(s, 0, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -5268,8 +5268,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -5280,8 +5280,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::async_read_at(s, 0, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -5292,8 +5292,8 @@ void test_5_arg_boost_array_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -5302,8 +5302,8 @@ void test_5_arg_boost_array_buffers_async_read_at() int i = asio::async_read_at(s, 1234, buffers, short_transfer, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); #endif // defined(ASIO_HAS_BOOST_ARRAY) } @@ -5319,8 +5319,8 @@ void test_5_arg_std_array_buffers_async_read_at() #endif // defined(ASIO_HAS_BOOST_BIND) #if defined(ASIO_HAS_STD_ARRAY) - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; std::array buffers = { { asio::buffer(read_buf, 32), @@ -5333,8 +5333,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -5345,8 +5345,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -5358,8 +5358,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -5371,8 +5371,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -5384,8 +5384,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -5397,8 +5397,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -5409,8 +5409,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -5421,8 +5421,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -5434,8 +5434,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -5447,8 +5447,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -5460,8 +5460,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -5473,8 +5473,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -5485,8 +5485,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -5497,8 +5497,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -5510,8 +5510,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -5523,8 +5523,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -5536,8 +5536,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -5549,8 +5549,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -5561,8 +5561,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -5573,8 +5573,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -5586,8 +5586,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -5599,8 +5599,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -5612,8 +5612,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 50)); @@ -5625,8 +5625,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 50)); @@ -5637,8 +5637,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -5649,8 +5649,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -5662,8 +5662,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -5675,8 +5675,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -5688,8 +5688,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -5701,8 +5701,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -5713,8 +5713,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -5725,8 +5725,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -5738,8 +5738,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -5751,8 +5751,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -5764,8 +5764,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -5777,8 +5777,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -5789,8 +5789,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -5801,8 +5801,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -5814,8 +5814,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -5827,8 +5827,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -5840,8 +5840,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -5853,8 +5853,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -5864,8 +5864,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::async_read_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -5875,8 +5875,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -5887,8 +5887,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::async_read_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -5899,8 +5899,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -5911,8 +5911,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::async_read_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -5923,8 +5923,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -5934,8 +5934,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::async_read_at(s, 0, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -5945,8 +5945,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -5957,8 +5957,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::async_read_at(s, 0, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -5969,8 +5969,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -5981,8 +5981,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::async_read_at(s, 0, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -5993,8 +5993,8 @@ void test_5_arg_std_array_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -6003,8 +6003,8 @@ void test_5_arg_std_array_buffers_async_read_at() int i = asio::async_read_at(s, 1234, buffers, short_transfer, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); #endif // defined(ASIO_HAS_STD_ARRAY) } @@ -6019,8 +6019,8 @@ void test_5_arg_vector_buffers_async_read_at() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; std::vector buffers; buffers.push_back(asio::buffer(read_buf, 32)); @@ -6033,8 +6033,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -6045,8 +6045,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -6058,8 +6058,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -6071,8 +6071,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -6084,8 +6084,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -6097,8 +6097,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -6109,8 +6109,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -6121,8 +6121,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -6134,8 +6134,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -6147,8 +6147,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -6160,8 +6160,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -6173,8 +6173,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -6185,8 +6185,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -6197,8 +6197,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -6210,8 +6210,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -6223,8 +6223,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -6236,8 +6236,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -6249,8 +6249,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -6261,8 +6261,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -6273,8 +6273,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -6286,8 +6286,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -6299,8 +6299,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -6312,8 +6312,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 50)); @@ -6325,8 +6325,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 50)); @@ -6337,8 +6337,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -6349,8 +6349,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -6362,8 +6362,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -6375,8 +6375,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -6388,8 +6388,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -6401,8 +6401,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -6413,8 +6413,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -6425,8 +6425,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -6438,8 +6438,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -6451,8 +6451,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -6464,8 +6464,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -6477,8 +6477,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -6489,8 +6489,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -6501,8 +6501,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -6514,8 +6514,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -6527,8 +6527,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -6540,8 +6540,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -6553,8 +6553,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -6564,8 +6564,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::async_read_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -6575,8 +6575,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -6587,8 +6587,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::async_read_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -6599,8 +6599,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -6611,8 +6611,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::async_read_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -6623,8 +6623,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -6634,8 +6634,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::async_read_at(s, 0, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -6645,8 +6645,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -6657,8 +6657,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::async_read_at(s, 0, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -6669,8 +6669,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -6681,8 +6681,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::async_read_at(s, 0, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); @@ -6693,8 +6693,8 @@ void test_5_arg_vector_buffers_async_read_at() asio::async_read_at(s, 1234, buffers, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); @@ -6703,8 +6703,8 @@ void test_5_arg_vector_buffers_async_read_at() int i = asio::async_read_at(s, 1234, buffers, short_transfer, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); } @@ -6718,8 +6718,8 @@ void test_5_arg_streambuf_async_read_at() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); asio::streambuf sb(sizeof(read_data)); s.reset(read_data, sizeof(read_data)); @@ -6729,8 +6729,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); @@ -6742,8 +6742,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); @@ -6756,8 +6756,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); @@ -6770,8 +6770,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); @@ -6784,8 +6784,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); @@ -6798,8 +6798,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); @@ -6811,8 +6811,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); @@ -6824,8 +6824,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); @@ -6838,8 +6838,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 1); ASIO_CHECK(s.check_buffers(0, sb.data(), 1)); @@ -6852,8 +6852,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 1); ASIO_CHECK(s.check_buffers(1234, sb.data(), 1)); @@ -6866,8 +6866,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 10); ASIO_CHECK(s.check_buffers(0, sb.data(), 10)); @@ -6880,8 +6880,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 10); ASIO_CHECK(s.check_buffers(1234, sb.data(), 10)); @@ -6893,8 +6893,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); @@ -6906,8 +6906,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); @@ -6920,8 +6920,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 10); ASIO_CHECK(s.check_buffers(0, sb.data(), 10)); @@ -6934,8 +6934,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 10); ASIO_CHECK(s.check_buffers(1234, sb.data(), 10)); @@ -6948,8 +6948,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 10); ASIO_CHECK(s.check_buffers(0, sb.data(), 10)); @@ -6962,8 +6962,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 10); ASIO_CHECK(s.check_buffers(1234, sb.data(), 10)); @@ -6975,8 +6975,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); @@ -6988,8 +6988,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); @@ -7002,8 +7002,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 42); ASIO_CHECK(s.check_buffers(0, sb.data(), 42)); @@ -7016,8 +7016,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 42); ASIO_CHECK(s.check_buffers(1234, sb.data(), 42)); @@ -7030,8 +7030,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 50); ASIO_CHECK(s.check_buffers(0, sb.data(), 50)); @@ -7044,8 +7044,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 50); ASIO_CHECK(s.check_buffers(1234, sb.data(), 50)); @@ -7057,8 +7057,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 1); ASIO_CHECK(s.check_buffers(0, sb.data(), 1)); @@ -7070,8 +7070,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 1); ASIO_CHECK(s.check_buffers(1234, sb.data(), 1)); @@ -7084,8 +7084,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 1); ASIO_CHECK(s.check_buffers(0, sb.data(), 1)); @@ -7098,8 +7098,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 1); ASIO_CHECK(s.check_buffers(1234, sb.data(), 1)); @@ -7112,8 +7112,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 1); ASIO_CHECK(s.check_buffers(0, sb.data(), 1)); @@ -7126,8 +7126,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 1); ASIO_CHECK(s.check_buffers(1234, sb.data(), 1)); @@ -7139,8 +7139,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 10); ASIO_CHECK(s.check_buffers(0, sb.data(), 10)); @@ -7152,8 +7152,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 10); ASIO_CHECK(s.check_buffers(1234, sb.data(), 10)); @@ -7166,8 +7166,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 10); ASIO_CHECK(s.check_buffers(0, sb.data(), 10)); @@ -7180,8 +7180,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 10); ASIO_CHECK(s.check_buffers(1234, sb.data(), 10)); @@ -7194,8 +7194,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 10); ASIO_CHECK(s.check_buffers(0, sb.data(), 10)); @@ -7208,8 +7208,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 10); ASIO_CHECK(s.check_buffers(1234, sb.data(), 10)); @@ -7221,8 +7221,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 42); ASIO_CHECK(s.check_buffers(0, sb.data(), 42)); @@ -7234,8 +7234,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 42); ASIO_CHECK(s.check_buffers(1234, sb.data(), 42)); @@ -7248,8 +7248,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 42); ASIO_CHECK(s.check_buffers(0, sb.data(), 42)); @@ -7262,8 +7262,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 42); ASIO_CHECK(s.check_buffers(1234, sb.data(), 42)); @@ -7276,8 +7276,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 42); ASIO_CHECK(s.check_buffers(0, sb.data(), 42)); @@ -7290,8 +7290,8 @@ void test_5_arg_streambuf_async_read_at() asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == 42); ASIO_CHECK(s.check_buffers(1234, sb.data(), 42)); @@ -7302,8 +7302,8 @@ void test_5_arg_streambuf_async_read_at() asio::async_read_at(s, 0, sb, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); @@ -7314,8 +7314,8 @@ void test_5_arg_streambuf_async_read_at() asio::async_read_at(s, 1234, sb, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); @@ -7327,8 +7327,8 @@ void test_5_arg_streambuf_async_read_at() asio::async_read_at(s, 0, sb, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); @@ -7340,8 +7340,8 @@ void test_5_arg_streambuf_async_read_at() asio::async_read_at(s, 1234, sb, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); @@ -7353,8 +7353,8 @@ void test_5_arg_streambuf_async_read_at() asio::async_read_at(s, 0, sb, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); @@ -7366,8 +7366,8 @@ void test_5_arg_streambuf_async_read_at() asio::async_read_at(s, 1234, sb, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); @@ -7378,8 +7378,8 @@ void test_5_arg_streambuf_async_read_at() asio::async_read_at(s, 0, sb, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); @@ -7390,8 +7390,8 @@ void test_5_arg_streambuf_async_read_at() asio::async_read_at(s, 1234, sb, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); @@ -7403,8 +7403,8 @@ void test_5_arg_streambuf_async_read_at() asio::async_read_at(s, 0, sb, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); @@ -7416,8 +7416,8 @@ void test_5_arg_streambuf_async_read_at() asio::async_read_at(s, 1234, sb, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); @@ -7429,8 +7429,8 @@ void test_5_arg_streambuf_async_read_at() asio::async_read_at(s, 0, sb, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); @@ -7442,8 +7442,8 @@ void test_5_arg_streambuf_async_read_at() asio::async_read_at(s, 1234, sb, short_transfer, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(sb.size() == sizeof(read_data)); ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); @@ -7453,8 +7453,8 @@ void test_5_arg_streambuf_async_read_at() int i = asio::async_read_at(s, 1234, sb, short_transfer, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); } diff --git a/asio/src/tests/unit/read_until.cpp b/asio/src/tests/unit/read_until.cpp index 6a380fce..a3bdf07d 100644 --- a/asio/src/tests/unit/read_until.cpp +++ b/asio/src/tests/unit/read_until.cpp @@ -18,7 +18,7 @@ #include #include "archetypes/async_result.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/post.hpp" #include "asio/streambuf.hpp" #include "unit_test.hpp" @@ -32,10 +32,10 @@ class test_stream { public: - typedef asio::io_service::executor_type executor_type; + typedef asio::io_context::executor_type executor_type; - test_stream(asio::io_service& io_service) - : io_service_(io_service), + test_stream(asio::io_context& io_context) + : io_context_(io_context), length_(0), position_(0), next_read_length_(0) @@ -44,7 +44,7 @@ public: executor_type get_executor() ASIO_NOEXCEPT { - return io_service_.get_executor(); + return io_context_.get_executor(); } void reset(const void* data, size_t length) @@ -93,7 +93,7 @@ public: } private: - asio::io_service& io_service_; + asio::io_context& io_context_; enum { max_length = 8192 }; char data_[max_length]; size_t length_; @@ -106,8 +106,8 @@ static const char read_data[] void test_char_read_until() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); asio::streambuf sb1; asio::streambuf sb2(25); asio::error_code ec; @@ -192,8 +192,8 @@ void test_char_read_until() void test_string_read_until() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); asio::streambuf sb1; asio::streambuf sb2(25); asio::error_code ec; @@ -305,8 +305,8 @@ namespace asio { void test_match_condition_read_until() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); asio::streambuf sb1; asio::streambuf sb2(25); asio::error_code ec; @@ -408,8 +408,8 @@ void test_char_async_read_until() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); asio::streambuf sb1; asio::streambuf sb2(25); asio::error_code ec; @@ -424,8 +424,8 @@ void test_char_async_read_until() asio::async_read_until(s, sb1, 'Z', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(!ec); ASIO_CHECK(length == 26); @@ -439,8 +439,8 @@ void test_char_async_read_until() asio::async_read_until(s, sb1, 'Z', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(!ec); ASIO_CHECK(length == 26); @@ -454,8 +454,8 @@ void test_char_async_read_until() asio::async_read_until(s, sb1, 'Z', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(!ec); ASIO_CHECK(length == 26); @@ -468,8 +468,8 @@ void test_char_async_read_until() asio::async_read_until(s, sb2, 'Z', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(ec == asio::error::not_found); ASIO_CHECK(length == 0); @@ -483,8 +483,8 @@ void test_char_async_read_until() asio::async_read_until(s, sb2, 'Z', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(ec == asio::error::not_found); ASIO_CHECK(length == 0); @@ -498,8 +498,8 @@ void test_char_async_read_until() asio::async_read_until(s, sb2, 'Z', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(ec == asio::error::not_found); ASIO_CHECK(length == 0); @@ -512,8 +512,8 @@ void test_char_async_read_until() asio::async_read_until(s, sb2, 'Y', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(!ec); ASIO_CHECK(length == 25); @@ -527,8 +527,8 @@ void test_char_async_read_until() asio::async_read_until(s, sb2, 'Y', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(!ec); ASIO_CHECK(length == 25); @@ -542,8 +542,8 @@ void test_char_async_read_until() asio::async_read_until(s, sb2, 'Y', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(!ec); ASIO_CHECK(length == 25); @@ -553,8 +553,8 @@ void test_char_async_read_until() int i = asio::async_read_until(s, sb2, 'Y', archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); } void test_string_async_read_until() @@ -567,8 +567,8 @@ void test_string_async_read_until() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); asio::streambuf sb1; asio::streambuf sb2(25); asio::error_code ec; @@ -583,8 +583,8 @@ void test_string_async_read_until() asio::async_read_until(s, sb1, "XYZ", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(!ec); ASIO_CHECK(length == 26); @@ -598,8 +598,8 @@ void test_string_async_read_until() asio::async_read_until(s, sb1, "XYZ", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(!ec); ASIO_CHECK(length == 26); @@ -613,8 +613,8 @@ void test_string_async_read_until() asio::async_read_until(s, sb1, "XYZ", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(!ec); ASIO_CHECK(length == 26); @@ -627,8 +627,8 @@ void test_string_async_read_until() asio::async_read_until(s, sb2, "XYZ", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(ec == asio::error::not_found); ASIO_CHECK(length == 0); @@ -642,8 +642,8 @@ void test_string_async_read_until() asio::async_read_until(s, sb2, "XYZ", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(ec == asio::error::not_found); ASIO_CHECK(length == 0); @@ -657,8 +657,8 @@ void test_string_async_read_until() asio::async_read_until(s, sb2, "XYZ", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(ec == asio::error::not_found); ASIO_CHECK(length == 0); @@ -671,8 +671,8 @@ void test_string_async_read_until() asio::async_read_until(s, sb2, "WXY", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(!ec); ASIO_CHECK(length == 25); @@ -686,8 +686,8 @@ void test_string_async_read_until() asio::async_read_until(s, sb2, "WXY", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(!ec); ASIO_CHECK(length == 25); @@ -701,8 +701,8 @@ void test_string_async_read_until() asio::async_read_until(s, sb2, "WXY", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(!ec); ASIO_CHECK(length == 25); @@ -712,8 +712,8 @@ void test_string_async_read_until() int i = asio::async_read_until(s, sb2, "WXY", archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); } void test_match_condition_async_read_until() @@ -726,8 +726,8 @@ void test_match_condition_async_read_until() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); asio::streambuf sb1; asio::streambuf sb2(25); asio::error_code ec; @@ -742,8 +742,8 @@ void test_match_condition_async_read_until() asio::async_read_until(s, sb1, match_char('Z'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(!ec); ASIO_CHECK(length == 26); @@ -757,8 +757,8 @@ void test_match_condition_async_read_until() asio::async_read_until(s, sb1, match_char('Z'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(!ec); ASIO_CHECK(length == 26); @@ -772,8 +772,8 @@ void test_match_condition_async_read_until() asio::async_read_until(s, sb1, match_char('Z'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(!ec); ASIO_CHECK(length == 26); @@ -786,8 +786,8 @@ void test_match_condition_async_read_until() asio::async_read_until(s, sb2, match_char('Z'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(ec == asio::error::not_found); ASIO_CHECK(length == 0); @@ -801,8 +801,8 @@ void test_match_condition_async_read_until() asio::async_read_until(s, sb2, match_char('Z'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(ec == asio::error::not_found); ASIO_CHECK(length == 0); @@ -816,8 +816,8 @@ void test_match_condition_async_read_until() asio::async_read_until(s, sb2, match_char('Z'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(ec == asio::error::not_found); ASIO_CHECK(length == 0); @@ -830,8 +830,8 @@ void test_match_condition_async_read_until() asio::async_read_until(s, sb2, match_char('Y'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(!ec); ASIO_CHECK(length == 25); @@ -845,8 +845,8 @@ void test_match_condition_async_read_until() asio::async_read_until(s, sb2, match_char('Y'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(!ec); ASIO_CHECK(length == 25); @@ -860,8 +860,8 @@ void test_match_condition_async_read_until() asio::async_read_until(s, sb2, match_char('Y'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(!ec); ASIO_CHECK(length == 25); @@ -871,8 +871,8 @@ void test_match_condition_async_read_until() int i = asio::async_read_until(s, sb2, match_char('Y'), archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); } ASIO_TEST_SUITE diff --git a/asio/src/tests/unit/serial_port.cpp b/asio/src/tests/unit/serial_port.cpp index 1db81020..6171afc9 100644 --- a/asio/src/tests/unit/serial_port.cpp +++ b/asio/src/tests/unit/serial_port.cpp @@ -18,7 +18,7 @@ #include "asio/serial_port.hpp" #include "archetypes/async_result.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "unit_test.hpp" //------------------------------------------------------------------------------ @@ -59,7 +59,7 @@ void test() try { - io_service ios; + io_context ioc; char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; serial_port::baud_rate serial_port_option; @@ -68,10 +68,10 @@ void test() // basic_serial_port constructors. - serial_port port1(ios); - serial_port port2(ios, "null"); + serial_port port1(ioc); + serial_port port2(ioc, "null"); serial_port::native_handle_type native_port1 = port1.native_handle(); - serial_port port3(ios, native_port1); + serial_port port3(ioc, native_port1); #if defined(ASIO_HAS_MOVE) serial_port port4(std::move(port3)); @@ -80,14 +80,14 @@ void test() // basic_serial_port operators. #if defined(ASIO_HAS_MOVE) - port1 = serial_port(ios); + port1 = serial_port(ioc); port1 = std::move(port2); #endif // defined(ASIO_HAS_MOVE) // basic_io_object functions. - io_service& ios_ref = port1.get_io_service(); - (void)ios_ref; + io_context& ioc_ref = port1.get_io_context(); + (void)ioc_ref; // basic_serial_port functions. diff --git a/asio/src/tests/unit/serial_port_base.cpp b/asio/src/tests/unit/serial_port_base.cpp index 42ab8ac8..3949761a 100644 --- a/asio/src/tests/unit/serial_port_base.cpp +++ b/asio/src/tests/unit/serial_port_base.cpp @@ -17,7 +17,7 @@ // Test that header file is self-contained. #include "asio/serial_port_base.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/serial_port.hpp" #include "unit_test.hpp" @@ -37,8 +37,8 @@ void test() try { - io_service ios; - serial_port port(ios); + io_context ioc; + serial_port port(ioc); // baud_rate class. diff --git a/asio/src/tests/unit/signal_set.cpp b/asio/src/tests/unit/signal_set.cpp index d93830bf..c0356d29 100644 --- a/asio/src/tests/unit/signal_set.cpp +++ b/asio/src/tests/unit/signal_set.cpp @@ -17,7 +17,7 @@ #include "asio/signal_set.hpp" #include "archetypes/async_result.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "unit_test.hpp" //------------------------------------------------------------------------------ @@ -39,21 +39,21 @@ void test() try { - io_service ios; + io_context ioc; archetypes::lazy_handler lazy; asio::error_code ec; // basic_signal_set constructors. - signal_set set1(ios); - signal_set set2(ios, 1); - signal_set set3(ios, 1, 2); - signal_set set4(ios, 1, 2, 3); + signal_set set1(ioc); + signal_set set2(ioc, 1); + signal_set set3(ioc, 1, 2); + signal_set set4(ioc, 1, 2, 3); // basic_io_object functions. - io_service& ios_ref = set1.get_io_service(); - (void)ios_ref; + io_context& ioc_ref = set1.get_io_context(); + (void)ioc_ref; // basic_signal_set functions. diff --git a/asio/src/tests/unit/socket_base.cpp b/asio/src/tests/unit/socket_base.cpp index 9762d57a..0b0adf92 100644 --- a/asio/src/tests/unit/socket_base.cpp +++ b/asio/src/tests/unit/socket_base.cpp @@ -16,7 +16,7 @@ // Test that header file is self-contained. #include "asio/socket_base.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/ip/tcp.hpp" #include "asio/ip/udp.hpp" #include "unit_test.hpp" @@ -37,8 +37,8 @@ void test() try { - io_service ios; - ip::tcp::socket sock(ios); + io_context ioc; + ip::tcp::socket sock(ioc); char buf[1024]; // shutdown_type enumeration. @@ -194,10 +194,10 @@ void test() using namespace asio; namespace ip = asio::ip; - io_service ios; - ip::udp::socket udp_sock(ios, ip::udp::v4()); - ip::tcp::socket tcp_sock(ios, ip::tcp::v4()); - ip::tcp::acceptor tcp_acceptor(ios, ip::tcp::v4()); + io_context ioc; + ip::udp::socket udp_sock(ioc, ip::udp::v4()); + ip::tcp::socket tcp_sock(ioc, ip::tcp::v4()); + ip::tcp::acceptor tcp_acceptor(ioc, ip::tcp::v4()); asio::error_code ec; // broadcast class. diff --git a/asio/src/tests/unit/ssl/stream.cpp b/asio/src/tests/unit/ssl/stream.cpp index 7e274088..2020283c 100644 --- a/asio/src/tests/unit/ssl/stream.cpp +++ b/asio/src/tests/unit/ssl/stream.cpp @@ -62,7 +62,7 @@ void test() try { - io_service ios; + io_context ioc; char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; asio::ssl::context context(asio::ssl::context::sslv23); @@ -71,14 +71,14 @@ void test() // ssl::stream constructors. - ssl::stream stream1(ios, context); - ip::tcp::socket socket1(ios, ip::tcp::v4()); + ssl::stream stream1(ioc, context); + ip::tcp::socket socket1(ioc, ip::tcp::v4()); ssl::stream stream2(socket1, context); // basic_io_object functions. - io_service& ios_ref = stream1.get_io_service(); - (void)ios_ref; + io_context& ioc_ref = stream1.get_io_context(); + (void)ioc_ref; // ssl::stream functions. diff --git a/asio/src/tests/unit/strand.cpp b/asio/src/tests/unit/strand.cpp index 639b4112..5b01e2dc 100644 --- a/asio/src/tests/unit/strand.cpp +++ b/asio/src/tests/unit/strand.cpp @@ -17,7 +17,7 @@ #include "asio/strand.hpp" #include -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/post.hpp" #include "asio/thread.hpp" #include "unit_test.hpp" @@ -58,7 +58,7 @@ void increment(int* count) ++(*count); } -void increment_without_lock(io_service::strand* s, int* count) +void increment_without_lock(io_context::strand* s, int* count) { ASIO_CHECK(!s->running_in_this_thread()); @@ -71,7 +71,7 @@ void increment_without_lock(io_service::strand* s, int* count) ASIO_CHECK(*count == original_count + 1); } -void increment_with_lock(io_service::strand* s, int* count) +void increment_with_lock(io_context::strand* s, int* count) { ASIO_CHECK(s->running_in_this_thread()); @@ -84,24 +84,24 @@ void increment_with_lock(io_service::strand* s, int* count) ASIO_CHECK(*count == original_count + 1); } -void sleep_increment(io_service* ios, int* count) +void sleep_increment(io_context* ioc, int* count) { - timer t(*ios, chronons::seconds(2)); + timer t(*ioc, chronons::seconds(2)); t.wait(); ++(*count); } -void start_sleep_increments(io_service* ios, io_service::strand* s, int* count) +void start_sleep_increments(io_context* ioc, io_context::strand* s, int* count) { // Give all threads a chance to start. - timer t(*ios, chronons::seconds(2)); + timer t(*ioc, chronons::seconds(2)); t.wait(); // Start three increments. - s->post(bindns::bind(sleep_increment, ios, count)); - s->post(bindns::bind(sleep_increment, ios, count)); - s->post(bindns::bind(sleep_increment, ios, count)); + s->post(bindns::bind(sleep_increment, ioc, count)); + s->post(bindns::bind(sleep_increment, ioc, count)); + s->post(bindns::bind(sleep_increment, ioc, count)); } void throw_exception() @@ -109,47 +109,47 @@ void throw_exception() throw 1; } -void io_service_run(io_service* ios) +void io_context_run(io_context* ioc) { - ios->run(); + ioc->run(); } void strand_test() { - io_service ios; - io_service::strand s(ios); + io_context ioc; + io_context::strand s(ioc); int count = 0; - post(ios, bindns::bind(increment_without_lock, &s, &count)); + post(ioc, bindns::bind(increment_without_lock, &s, &count)); // No handlers can be called until run() is called. ASIO_CHECK(count == 0); - ios.run(); + ioc.run(); // The run() call will not return until all work has finished. ASIO_CHECK(count == 1); count = 0; - ios.restart(); + ioc.restart(); post(s, bindns::bind(increment_with_lock, &s, &count)); // No handlers can be called until run() is called. ASIO_CHECK(count == 0); - ios.run(); + ioc.run(); // The run() call will not return until all work has finished. ASIO_CHECK(count == 1); count = 0; - ios.restart(); - post(ios, bindns::bind(start_sleep_increments, &ios, &s, &count)); - thread thread1(bindns::bind(io_service_run, &ios)); - thread thread2(bindns::bind(io_service_run, &ios)); + ioc.restart(); + post(ioc, bindns::bind(start_sleep_increments, &ioc, &s, &count)); + thread thread1(bindns::bind(io_context_run, &ioc)); + thread thread2(bindns::bind(io_context_run, &ioc)); // Check all events run one after another even though there are two threads. - timer timer1(ios, chronons::seconds(3)); + timer timer1(ioc, chronons::seconds(3)); timer1.wait(); ASIO_CHECK(count == 0); #if defined(ASIO_HAS_BOOST_DATE_TIME) @@ -175,7 +175,7 @@ void strand_test() count = 0; int exception_count = 0; - ios.restart(); + ioc.restart(); post(s, throw_exception); post(s, bindns::bind(increment, &count)); post(s, bindns::bind(increment, &count)); @@ -190,7 +190,7 @@ void strand_test() { try { - ios.run(); + ioc.run(); break; } catch (int) @@ -204,12 +204,12 @@ void strand_test() ASIO_CHECK(exception_count == 2); count = 0; - ios.restart(); + ioc.restart(); // Check for clean shutdown when handlers posted through an orphaned strand // are abandoned. { - io_service::strand s2(ios); + io_context::strand s2(ioc); post(s2, bindns::bind(increment, &count)); post(s2, bindns::bind(increment, &count)); post(s2, bindns::bind(increment, &count)); diff --git a/asio/src/tests/unit/system_timer.cpp b/asio/src/tests/unit/system_timer.cpp index 8228fe88..9aa41cee 100644 --- a/asio/src/tests/unit/system_timer.cpp +++ b/asio/src/tests/unit/system_timer.cpp @@ -25,7 +25,7 @@ #if defined(ASIO_HAS_STD_CHRONO) -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/thread.hpp" #if defined(ASIO_HAS_BOOST_BIND) @@ -96,12 +96,12 @@ void system_timer_test() using std::placeholders::_2; #endif // !defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; + asio::io_context ioc; int count = 0; asio::system_timer::time_point start = now(); - asio::system_timer t1(ios, seconds(1)); + asio::system_timer t1(ioc, seconds(1)); t1.wait(); // The timer must block until after its expiry time. @@ -111,7 +111,7 @@ void system_timer_test() start = now(); - asio::system_timer t2(ios, seconds(1) + microseconds(500000)); + asio::system_timer t2(ioc, seconds(1) + microseconds(500000)); t2.wait(); // The timer must block until after its expiry time. @@ -139,13 +139,13 @@ void system_timer_test() start = now(); - asio::system_timer t3(ios, seconds(5)); + asio::system_timer t3(ioc, seconds(5)); t3.async_wait(bindns::bind(increment, &count)); // No completions can be delivered until run() is called. ASIO_CHECK(count == 0); - ios.run(); + ioc.run(); // The run() call will not return until all operations have finished, and // this should not be until after the timer's expiry time. @@ -157,14 +157,14 @@ void system_timer_test() count = 3; start = now(); - asio::system_timer t4(ios, seconds(1)); + asio::system_timer t4(ioc, seconds(1)); t4.async_wait(bindns::bind(decrement_to_zero, &t4, &count)); // No completions can be delivered until run() is called. ASIO_CHECK(count == 3); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); // The run() call will not return until all operations have finished, and // this should not be until after the timer's final expiry time. @@ -176,16 +176,16 @@ void system_timer_test() count = 0; start = now(); - asio::system_timer t5(ios, seconds(10)); + asio::system_timer t5(ioc, seconds(10)); t5.async_wait(bindns::bind(increment_if_not_cancelled, &count, _1)); - asio::system_timer t6(ios, seconds(1)); + asio::system_timer t6(ioc, seconds(1)); t6.async_wait(bindns::bind(cancel_timer, &t5)); // No completions can be delivered until run() is called. ASIO_CHECK(count == 0); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); // The timer should have been cancelled, so count should not have changed. // The total run time should not have been much more than 1 second (and @@ -199,8 +199,8 @@ void system_timer_test() // wait should run to completion and increment the counter. t5.async_wait(bindns::bind(increment_if_not_cancelled, &count, _1)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); // The timer should not have been cancelled, so count should have changed. // The total time since the timer was created should be more than 10 seconds. @@ -215,14 +215,14 @@ void system_timer_test() // Start two waits on a timer, one of which will be cancelled. The one // which is not cancelled should still run to completion and increment the // counter. - asio::system_timer t7(ios, seconds(3)); + asio::system_timer t7(ioc, seconds(3)); t7.async_wait(bindns::bind(increment_if_not_cancelled, &count, _1)); t7.async_wait(bindns::bind(increment_if_not_cancelled, &count, _1)); - asio::system_timer t8(ios, seconds(1)); + asio::system_timer t8(ioc, seconds(1)); t8.async_wait(bindns::bind(cancel_one_timer, &t7)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); // One of the waits should not have been cancelled, so count should have // changed. The total time since the timer was created should be more than 3 @@ -246,11 +246,11 @@ private: void system_timer_cancel_test() { - static asio::io_service io_service; + static asio::io_context io_context; struct timer { asio::system_timer t; - timer() : t(io_service) + timer() : t(io_context) { t.expires_at((asio::system_timer::time_point::max)()); } @@ -290,11 +290,11 @@ void asio_handler_deallocate(void* pointer, std::size_t, void system_timer_custom_allocation_test() { - static asio::io_service io_service; + static asio::io_context io_context; struct timer { asio::system_timer t; - timer() : t(io_service) {} + timer() : t(io_context) {} } timers[100]; int allocation_count = 0; @@ -314,25 +314,25 @@ void system_timer_custom_allocation_test() for (int i = 0; i < 50; ++i) timers[i].t.cancel(); - io_service.run(); + io_context.run(); ASIO_CHECK(allocation_count == 0); } -void io_service_run(asio::io_service* ios) +void io_context_run(asio::io_context* ioc) { - ios->run(); + ioc->run(); } void system_timer_thread_test() { - asio::io_service ios; - asio::io_service::work w(ios); - asio::system_timer t1(ios); - asio::system_timer t2(ios); + asio::io_context ioc; + asio::io_context::work w(ioc); + asio::system_timer t1(ioc); + asio::system_timer t2(ioc); int count = 0; - asio::thread th(bindns::bind(io_service_run, &ios)); + asio::thread th(bindns::bind(io_context_run, &ioc)); t2.expires_after(chronons::seconds(2)); t2.wait(); @@ -343,16 +343,16 @@ void system_timer_thread_test() t2.expires_after(chronons::seconds(4)); t2.wait(); - ios.stop(); + ioc.stop(); th.join(); ASIO_CHECK(count == 1); } #if defined(ASIO_HAS_MOVE) -asio::system_timer make_timer(asio::io_service& ios, int* count) +asio::system_timer make_timer(asio::io_context& ioc, int* count) { - asio::system_timer t(ios); + asio::system_timer t(ioc); t.expires_after(std::chrono::seconds(1)); t.async_wait(bindns::bind(increment, count)); return t; @@ -362,21 +362,21 @@ asio::system_timer make_timer(asio::io_service& ios, int* count) void system_timer_move_test() { #if defined(ASIO_HAS_MOVE) - asio::io_service io_service1; - asio::io_service io_service2; + asio::io_context io_context1; + asio::io_context io_context2; int count = 0; - asio::system_timer t1 = make_timer(io_service1, &count); - asio::system_timer t2 = make_timer(io_service2, &count); + asio::system_timer t1 = make_timer(io_context1, &count); + asio::system_timer t2 = make_timer(io_context2, &count); asio::system_timer t3 = std::move(t1); t2 = std::move(t1); - io_service2.run(); + io_context2.run(); ASIO_CHECK(count == 1); - io_service1.run(); + io_context1.run(); ASIO_CHECK(count == 2); #endif // defined(ASIO_HAS_MOVE) diff --git a/asio/src/tests/unit/windows/object_handle.cpp b/asio/src/tests/unit/windows/object_handle.cpp index 11b8b761..e35d62f6 100644 --- a/asio/src/tests/unit/windows/object_handle.cpp +++ b/asio/src/tests/unit/windows/object_handle.cpp @@ -16,7 +16,7 @@ // Test that header file is self-contained. #include "asio/windows/object_handle.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "../archetypes/async_result.hpp" #include "../unit_test.hpp" @@ -42,15 +42,15 @@ void test() try { - io_service ios; + io_context ioc; archetypes::lazy_handler lazy; asio::error_code ec; // basic_object_handle constructors. - win::object_handle handle1(ios); + win::object_handle handle1(ioc); HANDLE native_handle1 = INVALID_HANDLE_VALUE; - win::object_handle handle2(ios, native_handle1); + win::object_handle handle2(ioc, native_handle1); #if defined(ASIO_HAS_MOVE) win::object_handle handle3(std::move(handle2)); @@ -59,14 +59,14 @@ void test() // basic_object_handle operators. #if defined(ASIO_HAS_MOVE) - handle1 = win::object_handle(ios); + handle1 = win::object_handle(ioc); handle1 = std::move(handle2); #endif // defined(ASIO_HAS_MOVE) // basic_io_object functions. - io_service& ios_ref = handle1.get_io_service(); - (void)ios_ref; + io_context& ioc_ref = handle1.get_io_context(); + (void)ioc_ref; // basic_handle functions. diff --git a/asio/src/tests/unit/windows/overlapped_ptr.cpp b/asio/src/tests/unit/windows/overlapped_ptr.cpp index f86380b8..33e443e2 100644 --- a/asio/src/tests/unit/windows/overlapped_ptr.cpp +++ b/asio/src/tests/unit/windows/overlapped_ptr.cpp @@ -16,7 +16,7 @@ // Test that header file is self-contained. #include "asio/windows/overlapped_ptr.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "../unit_test.hpp" //------------------------------------------------------------------------------ @@ -48,21 +48,21 @@ void test() try { - io_service ios; + io_context ioc; // basic_overlapped_ptr constructors. win::overlapped_ptr ptr1; - win::overlapped_ptr ptr2(ios, &overlapped_handler_1); - win::overlapped_ptr ptr3(ios, overlapped_handler_2()); + win::overlapped_ptr ptr2(ioc, &overlapped_handler_1); + win::overlapped_ptr ptr3(ioc, overlapped_handler_2()); // overlapped_ptr functions. ptr1.reset(); - ptr2.reset(ios, &overlapped_handler_1); - ptr3.reset(ios, overlapped_handler_2()); + ptr2.reset(ioc, &overlapped_handler_1); + ptr3.reset(ioc, overlapped_handler_2()); OVERLAPPED* ov1 = ptr1.get(); (void)ov1; diff --git a/asio/src/tests/unit/windows/random_access_handle.cpp b/asio/src/tests/unit/windows/random_access_handle.cpp index a2122692..210f06e6 100644 --- a/asio/src/tests/unit/windows/random_access_handle.cpp +++ b/asio/src/tests/unit/windows/random_access_handle.cpp @@ -16,7 +16,7 @@ // Test that header file is self-contained. #include "asio/windows/random_access_handle.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "../archetypes/async_result.hpp" #include "../unit_test.hpp" @@ -46,7 +46,7 @@ void test() try { - io_service ios; + io_context ioc; char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; asio::uint64_t offset = 0; @@ -55,9 +55,9 @@ void test() // basic_random_access_handle constructors. - win::random_access_handle handle1(ios); + win::random_access_handle handle1(ioc); HANDLE native_handle1 = INVALID_HANDLE_VALUE; - win::random_access_handle handle2(ios, native_handle1); + win::random_access_handle handle2(ioc, native_handle1); #if defined(ASIO_HAS_MOVE) win::random_access_handle handle3(std::move(handle2)); @@ -66,14 +66,14 @@ void test() // basic_random_access_handle operators. #if defined(ASIO_HAS_MOVE) - handle1 = win::random_access_handle(ios); + handle1 = win::random_access_handle(ioc); handle1 = std::move(handle2); #endif // defined(ASIO_HAS_MOVE) // basic_io_object functions. - io_service& ios_ref = handle1.get_io_service(); - (void)ios_ref; + io_context& ioc_ref = handle1.get_io_context(); + (void)ioc_ref; // basic_handle functions. diff --git a/asio/src/tests/unit/windows/stream_handle.cpp b/asio/src/tests/unit/windows/stream_handle.cpp index 9ad8c3d1..2f6bc808 100644 --- a/asio/src/tests/unit/windows/stream_handle.cpp +++ b/asio/src/tests/unit/windows/stream_handle.cpp @@ -16,7 +16,7 @@ // Test that header file is self-contained. #include "asio/windows/stream_handle.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "../archetypes/async_result.hpp" #include "../unit_test.hpp" @@ -46,7 +46,7 @@ void test() try { - io_service ios; + io_context ioc; char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; archetypes::lazy_handler lazy; @@ -54,9 +54,9 @@ void test() // basic_stream_handle constructors. - win::stream_handle handle1(ios); + win::stream_handle handle1(ioc); HANDLE native_handle1 = INVALID_HANDLE_VALUE; - win::stream_handle handle2(ios, native_handle1); + win::stream_handle handle2(ioc, native_handle1); #if defined(ASIO_HAS_MOVE) win::stream_handle handle3(std::move(handle2)); @@ -65,14 +65,14 @@ void test() // basic_stream_handle operators. #if defined(ASIO_HAS_MOVE) - handle1 = win::stream_handle(ios); + handle1 = win::stream_handle(ioc); handle1 = std::move(handle2); #endif // defined(ASIO_HAS_MOVE) // basic_io_object functions. - io_service& ios_ref = handle1.get_io_service(); - (void)ios_ref; + io_context& ioc_ref = handle1.get_io_context(); + (void)ioc_ref; // basic_handle functions. diff --git a/asio/src/tests/unit/write.cpp b/asio/src/tests/unit/write.cpp index dcbcc717..a747ad8c 100644 --- a/asio/src/tests/unit/write.cpp +++ b/asio/src/tests/unit/write.cpp @@ -19,7 +19,7 @@ #include #include #include "archetypes/async_result.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/post.hpp" #include "asio/streambuf.hpp" #include "unit_test.hpp" @@ -43,10 +43,10 @@ using namespace std; // For memcmp, memcpy and memset. class test_stream { public: - typedef asio::io_service::executor_type executor_type; + typedef asio::io_context::executor_type executor_type; - test_stream(asio::io_service& io_service) - : io_service_(io_service), + test_stream(asio::io_context& io_context) + : io_context_(io_context), length_(max_length), position_(0), next_write_length_(max_length) @@ -56,7 +56,7 @@ public: executor_type get_executor() ASIO_NOEXCEPT { - return io_service_.get_executor(); + return io_context_.get_executor(); } void reset(size_t length = max_length) @@ -125,7 +125,7 @@ public: } private: - asio::io_service& io_service_; + asio::io_context& io_context_; enum { max_length = 8192 }; char data_[max_length]; size_t length_; @@ -140,8 +140,8 @@ static char mutable_write_data[] void test_2_arg_zero_buffers_write() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); std::vector buffers; size_t bytes_transferred = asio::write(s, buffers); @@ -150,8 +150,8 @@ void test_2_arg_zero_buffers_write() void test_2_arg_const_buffers_1_write() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); asio::const_buffers_1 buffers = asio::buffer(write_data, sizeof(write_data)); @@ -175,8 +175,8 @@ void test_2_arg_const_buffers_1_write() void test_2_arg_mutable_buffers_1_write() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); asio::mutable_buffers_1 buffers = asio::buffer(mutable_write_data, sizeof(mutable_write_data)); @@ -200,8 +200,8 @@ void test_2_arg_mutable_buffers_1_write() void test_2_arg_vector_buffers_write() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); std::vector buffers; buffers.push_back(asio::buffer(write_data, 32)); buffers.push_back(asio::buffer(write_data) + 32); @@ -226,8 +226,8 @@ void test_2_arg_vector_buffers_write() void test_3_arg_nothrow_zero_buffers_write() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); std::vector buffers; asio::error_code error; @@ -238,8 +238,8 @@ void test_3_arg_nothrow_zero_buffers_write() void test_3_arg_nothrow_const_buffers_1_write() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); asio::const_buffers_1 buffers = asio::buffer(write_data, sizeof(write_data)); @@ -267,8 +267,8 @@ void test_3_arg_nothrow_const_buffers_1_write() void test_3_arg_nothrow_mutable_buffers_1_write() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); asio::mutable_buffers_1 buffers = asio::buffer(mutable_write_data, sizeof(mutable_write_data)); @@ -296,8 +296,8 @@ void test_3_arg_nothrow_mutable_buffers_1_write() void test_3_arg_nothrow_vector_buffers_write() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); std::vector buffers; buffers.push_back(asio::buffer(write_data, 32)); buffers.push_back(asio::buffer(write_data) + 32); @@ -338,8 +338,8 @@ size_t short_transfer(const asio::error_code& ec, void test_3_arg_const_buffers_1_write() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); asio::const_buffers_1 buffers = asio::buffer(write_data, sizeof(write_data)); @@ -520,8 +520,8 @@ void test_3_arg_const_buffers_1_write() void test_3_arg_mutable_buffers_1_write() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); asio::mutable_buffers_1 buffers = asio::buffer(mutable_write_data, sizeof(mutable_write_data)); @@ -702,8 +702,8 @@ void test_3_arg_mutable_buffers_1_write() void test_3_arg_vector_buffers_write() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); std::vector buffers; buffers.push_back(asio::buffer(write_data, 32)); buffers.push_back(asio::buffer(write_data) + 32); @@ -885,8 +885,8 @@ void test_3_arg_vector_buffers_write() void test_4_arg_const_buffers_1_write() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); asio::const_buffers_1 buffers = asio::buffer(write_data, sizeof(write_data)); @@ -1122,8 +1122,8 @@ void test_4_arg_const_buffers_1_write() void test_4_arg_mutable_buffers_1_write() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); asio::mutable_buffers_1 buffers = asio::buffer(mutable_write_data, sizeof(mutable_write_data)); @@ -1359,8 +1359,8 @@ void test_4_arg_mutable_buffers_1_write() void test_4_arg_vector_buffers_write() { - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); std::vector buffers; buffers.push_back(asio::buffer(write_data, 32)); buffers.push_back(asio::buffer(write_data) + 32); @@ -1613,8 +1613,8 @@ void test_3_arg_const_buffers_1_async_write() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); asio::const_buffers_1 buffers = asio::buffer(write_data, sizeof(write_data)); @@ -1623,8 +1623,8 @@ void test_3_arg_const_buffers_1_async_write() asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -1634,8 +1634,8 @@ void test_3_arg_const_buffers_1_async_write() asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -1645,16 +1645,16 @@ void test_3_arg_const_buffers_1_async_write() asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); int i = asio::async_write(s, buffers, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); } @@ -1668,8 +1668,8 @@ void test_3_arg_mutable_buffers_1_async_write() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); asio::mutable_buffers_1 buffers = asio::buffer(mutable_write_data, sizeof(mutable_write_data)); @@ -1678,8 +1678,8 @@ void test_3_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); @@ -1689,8 +1689,8 @@ void test_3_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); @@ -1700,16 +1700,16 @@ void test_3_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); int i = asio::async_write(s, buffers, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); } @@ -1724,8 +1724,8 @@ void test_3_arg_boost_array_buffers_async_write() #endif // defined(ASIO_HAS_BOOST_BIND) #if defined(ASIO_HAS_BOOST_ARRAY) - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); boost::array buffers = { { asio::buffer(write_data, 32), asio::buffer(write_data) + 32 } }; @@ -1735,8 +1735,8 @@ void test_3_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -1746,8 +1746,8 @@ void test_3_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -1757,16 +1757,16 @@ void test_3_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); int i = asio::async_write(s, buffers, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); #endif // defined(ASIO_HAS_BOOST_ARRAY) } @@ -1782,8 +1782,8 @@ void test_3_arg_std_array_buffers_async_write() #endif // defined(ASIO_HAS_BOOST_BIND) #if defined(ASIO_HAS_STD_ARRAY) - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); std::array buffers = { { asio::buffer(write_data, 32), asio::buffer(write_data) + 32 } }; @@ -1793,8 +1793,8 @@ void test_3_arg_std_array_buffers_async_write() asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -1804,8 +1804,8 @@ void test_3_arg_std_array_buffers_async_write() asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -1815,16 +1815,16 @@ void test_3_arg_std_array_buffers_async_write() asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); int i = asio::async_write(s, buffers, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); #endif // defined(ASIO_HAS_STD_ARRAY) } @@ -1839,8 +1839,8 @@ void test_3_arg_vector_buffers_async_write() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); std::vector buffers; buffers.push_back(asio::buffer(write_data, 32)); buffers.push_back(asio::buffer(write_data) + 32); @@ -1850,8 +1850,8 @@ void test_3_arg_vector_buffers_async_write() asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -1861,8 +1861,8 @@ void test_3_arg_vector_buffers_async_write() asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -1872,16 +1872,16 @@ void test_3_arg_vector_buffers_async_write() asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); int i = asio::async_write(s, buffers, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); } @@ -1895,8 +1895,8 @@ void test_3_arg_streambuf_async_write() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); asio::streambuf sb; asio::const_buffers_1 buffers = asio::buffer(write_data, sizeof(write_data)); @@ -1908,8 +1908,8 @@ void test_3_arg_streambuf_async_write() asio::async_write(s, sb, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -1921,8 +1921,8 @@ void test_3_arg_streambuf_async_write() asio::async_write(s, sb, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -1934,8 +1934,8 @@ void test_3_arg_streambuf_async_write() asio::async_write(s, sb, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -1944,8 +1944,8 @@ void test_3_arg_streambuf_async_write() sb.sputn(write_data, sizeof(write_data)); int i = asio::async_write(s, sb, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); } @@ -1959,8 +1959,8 @@ void test_4_arg_const_buffers_1_async_write() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); asio::const_buffers_1 buffers = asio::buffer(write_data, sizeof(write_data)); @@ -1969,8 +1969,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -1980,8 +1980,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -1991,8 +1991,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2001,8 +2001,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2012,8 +2012,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -2023,8 +2023,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2033,8 +2033,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2044,8 +2044,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2055,8 +2055,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2065,8 +2065,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2076,8 +2076,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -2087,8 +2087,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 50)); @@ -2097,8 +2097,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -2108,8 +2108,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -2119,8 +2119,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -2129,8 +2129,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2140,8 +2140,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2151,8 +2151,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2161,8 +2161,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -2172,8 +2172,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -2183,8 +2183,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -2193,8 +2193,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2204,8 +2204,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2215,8 +2215,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2225,8 +2225,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2236,8 +2236,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2247,8 +2247,8 @@ void test_4_arg_const_buffers_1_async_write() asio::async_write(s, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2256,8 +2256,8 @@ void test_4_arg_const_buffers_1_async_write() int i = asio::async_write(s, buffers, short_transfer, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); } @@ -2271,8 +2271,8 @@ void test_4_arg_mutable_buffers_1_async_write() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); asio::mutable_buffers_1 buffers = asio::buffer(mutable_write_data, sizeof(mutable_write_data)); @@ -2281,8 +2281,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); @@ -2292,8 +2292,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); @@ -2303,8 +2303,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); @@ -2313,8 +2313,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); @@ -2324,8 +2324,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -2335,8 +2335,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2345,8 +2345,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); @@ -2356,8 +2356,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2367,8 +2367,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2377,8 +2377,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); @@ -2388,8 +2388,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -2399,8 +2399,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 50)); @@ -2409,8 +2409,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -2420,8 +2420,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -2431,8 +2431,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -2441,8 +2441,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2452,8 +2452,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2463,8 +2463,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2473,8 +2473,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -2484,8 +2484,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -2495,8 +2495,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -2505,8 +2505,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); @@ -2516,8 +2516,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); @@ -2527,8 +2527,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); @@ -2537,8 +2537,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); @@ -2548,8 +2548,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); @@ -2559,8 +2559,8 @@ void test_4_arg_mutable_buffers_1_async_write() asio::async_write(s, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); @@ -2568,8 +2568,8 @@ void test_4_arg_mutable_buffers_1_async_write() int i = asio::async_write(s, buffers, short_transfer, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); } @@ -2584,8 +2584,8 @@ void test_4_arg_boost_array_buffers_async_write() #endif // defined(ASIO_HAS_BOOST_BIND) #if defined(ASIO_HAS_BOOST_ARRAY) - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); boost::array buffers = { { asio::buffer(write_data, 32), asio::buffer(write_data) + 32 } }; @@ -2595,8 +2595,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2606,8 +2606,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2617,8 +2617,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2627,8 +2627,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2638,8 +2638,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -2649,8 +2649,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2659,8 +2659,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2670,8 +2670,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2681,8 +2681,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2691,8 +2691,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2702,8 +2702,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -2713,8 +2713,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 50)); @@ -2723,8 +2723,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -2734,8 +2734,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -2745,8 +2745,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -2755,8 +2755,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2766,8 +2766,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2777,8 +2777,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2787,8 +2787,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -2798,8 +2798,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -2809,8 +2809,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -2819,8 +2819,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2830,8 +2830,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2841,8 +2841,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2851,8 +2851,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2862,8 +2862,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2873,8 +2873,8 @@ void test_4_arg_boost_array_buffers_async_write() asio::async_write(s, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2882,8 +2882,8 @@ void test_4_arg_boost_array_buffers_async_write() int i = asio::async_write(s, buffers, short_transfer, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); #endif // defined(ASIO_HAS_BOOST_ARRAY) } @@ -2899,8 +2899,8 @@ void test_4_arg_std_array_buffers_async_write() #endif // defined(ASIO_HAS_BOOST_BIND) #if defined(ASIO_HAS_STD_ARRAY) - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); std::array buffers = { { asio::buffer(write_data, 32), asio::buffer(write_data) + 32 } }; @@ -2910,8 +2910,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2921,8 +2921,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2932,8 +2932,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2942,8 +2942,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2953,8 +2953,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -2964,8 +2964,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2974,8 +2974,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -2985,8 +2985,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -2996,8 +2996,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -3006,8 +3006,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3017,8 +3017,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -3028,8 +3028,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 50)); @@ -3038,8 +3038,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -3049,8 +3049,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -3060,8 +3060,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -3070,8 +3070,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -3081,8 +3081,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -3092,8 +3092,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -3102,8 +3102,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -3113,8 +3113,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -3124,8 +3124,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -3134,8 +3134,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3145,8 +3145,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3156,8 +3156,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3166,8 +3166,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3177,8 +3177,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3188,8 +3188,8 @@ void test_4_arg_std_array_buffers_async_write() asio::async_write(s, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3197,8 +3197,8 @@ void test_4_arg_std_array_buffers_async_write() int i = asio::async_write(s, buffers, short_transfer, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); #endif // defined(ASIO_HAS_STD_ARRAY) } @@ -3213,8 +3213,8 @@ void test_4_arg_vector_buffers_async_write() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); std::vector buffers; buffers.push_back(asio::buffer(write_data, 32)); buffers.push_back(asio::buffer(write_data) + 32); @@ -3224,8 +3224,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3235,8 +3235,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3246,8 +3246,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3256,8 +3256,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3267,8 +3267,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -3278,8 +3278,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -3288,8 +3288,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3299,8 +3299,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -3310,8 +3310,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -3320,8 +3320,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3331,8 +3331,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -3342,8 +3342,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 50)); @@ -3352,8 +3352,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -3363,8 +3363,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -3374,8 +3374,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -3384,8 +3384,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -3395,8 +3395,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -3406,8 +3406,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -3416,8 +3416,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -3427,8 +3427,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -3438,8 +3438,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -3448,8 +3448,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3459,8 +3459,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3470,8 +3470,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3480,8 +3480,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3491,8 +3491,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3502,8 +3502,8 @@ void test_4_arg_vector_buffers_async_write() asio::async_write(s, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3511,8 +3511,8 @@ void test_4_arg_vector_buffers_async_write() int i = asio::async_write(s, buffers, short_transfer, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); } @@ -3526,8 +3526,8 @@ void test_4_arg_streambuf_async_write() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_stream s(ios); + asio::io_context ioc; + test_stream s(ioc); asio::streambuf sb; asio::const_buffers_1 buffers = asio::buffer(write_data, sizeof(write_data)); @@ -3539,8 +3539,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3552,8 +3552,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3565,8 +3565,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3577,8 +3577,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3590,8 +3590,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -3603,8 +3603,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -3615,8 +3615,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3628,8 +3628,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -3641,8 +3641,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -3653,8 +3653,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3666,8 +3666,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -3679,8 +3679,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 50)); @@ -3691,8 +3691,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -3704,8 +3704,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -3717,8 +3717,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 1)); @@ -3729,8 +3729,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -3742,8 +3742,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -3755,8 +3755,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 10)); @@ -3767,8 +3767,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -3780,8 +3780,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -3793,8 +3793,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, 42)); @@ -3805,8 +3805,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3818,8 +3818,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3831,8 +3831,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3843,8 +3843,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3856,8 +3856,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3869,8 +3869,8 @@ void test_4_arg_streambuf_async_write() asio::async_write(s, sb, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); @@ -3880,8 +3880,8 @@ void test_4_arg_streambuf_async_write() int i = asio::async_write(s, sb, short_transfer, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); } diff --git a/asio/src/tests/unit/write_at.cpp b/asio/src/tests/unit/write_at.cpp index 339011dd..fcc7e26a 100644 --- a/asio/src/tests/unit/write_at.cpp +++ b/asio/src/tests/unit/write_at.cpp @@ -18,7 +18,7 @@ #include #include "archetypes/async_result.hpp" -#include "asio/io_service.hpp" +#include "asio/io_context.hpp" #include "asio/post.hpp" #include "asio/streambuf.hpp" #include "unit_test.hpp" @@ -42,10 +42,10 @@ using namespace std; // For memcmp, memcpy and memset. class test_random_access_device { public: - typedef asio::io_service::executor_type executor_type; + typedef asio::io_context::executor_type executor_type; - test_random_access_device(asio::io_service& io_service) - : io_service_(io_service), + test_random_access_device(asio::io_context& io_context) + : io_context_(io_context), length_(max_length), next_write_length_(max_length) { @@ -54,7 +54,7 @@ public: executor_type get_executor() ASIO_NOEXCEPT { - return io_service_.get_executor(); + return io_context_.get_executor(); } void reset() @@ -121,7 +121,7 @@ public: } private: - asio::io_service& io_service_; + asio::io_context& io_context_; enum { max_length = 8192 }; char data_[max_length]; size_t length_; @@ -135,8 +135,8 @@ static char mutable_write_data[] void test_3_arg_const_buffers_1_write_at() { - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); asio::const_buffers_1 buffers = asio::buffer(write_data, sizeof(write_data)); @@ -177,8 +177,8 @@ void test_3_arg_const_buffers_1_write_at() void test_3_arg_mutable_buffers_1_write_at() { - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); asio::mutable_buffers_1 buffers = asio::buffer(mutable_write_data, sizeof(mutable_write_data)); @@ -219,8 +219,8 @@ void test_3_arg_mutable_buffers_1_write_at() void test_3_arg_vector_buffers_write_at() { - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); std::vector buffers; buffers.push_back(asio::buffer(write_data, 32)); buffers.push_back(asio::buffer(write_data) + 32); @@ -262,8 +262,8 @@ void test_3_arg_vector_buffers_write_at() void test_4_arg_nothrow_const_buffers_1_write_at() { - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); asio::const_buffers_1 buffers = asio::buffer(write_data, sizeof(write_data)); @@ -311,8 +311,8 @@ void test_4_arg_nothrow_const_buffers_1_write_at() void test_4_arg_nothrow_mutable_buffers_1_write_at() { - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); asio::mutable_buffers_1 buffers = asio::buffer(mutable_write_data, sizeof(mutable_write_data)); @@ -360,8 +360,8 @@ void test_4_arg_nothrow_mutable_buffers_1_write_at() void test_4_arg_nothrow_vector_buffers_write_at() { - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); std::vector buffers; buffers.push_back(asio::buffer(write_data, 32)); buffers.push_back(asio::buffer(write_data) + 32); @@ -422,8 +422,8 @@ size_t short_transfer(const asio::error_code& ec, void test_4_arg_const_buffers_1_write_at() { - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); asio::const_buffers_1 buffers = asio::buffer(write_data, sizeof(write_data)); @@ -784,8 +784,8 @@ void test_4_arg_const_buffers_1_write_at() void test_4_arg_mutable_buffers_1_write_at() { - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); asio::mutable_buffers_1 buffers = asio::buffer(mutable_write_data, sizeof(mutable_write_data)); @@ -1146,8 +1146,8 @@ void test_4_arg_mutable_buffers_1_write_at() void test_4_arg_vector_buffers_write_at() { - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); std::vector buffers; buffers.push_back(asio::buffer(write_data, 32)); buffers.push_back(asio::buffer(write_data) + 32); @@ -1509,8 +1509,8 @@ void test_4_arg_vector_buffers_write_at() void test_5_arg_const_buffers_1_write_at() { - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); asio::const_buffers_1 buffers = asio::buffer(write_data, sizeof(write_data)); @@ -1980,8 +1980,8 @@ void test_5_arg_const_buffers_1_write_at() void test_5_arg_mutable_buffers_1_write_at() { - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); asio::mutable_buffers_1 buffers = asio::buffer(mutable_write_data, sizeof(mutable_write_data)); @@ -2451,8 +2451,8 @@ void test_5_arg_mutable_buffers_1_write_at() void test_5_arg_vector_buffers_write_at() { - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); std::vector buffers; buffers.push_back(asio::buffer(write_data, 32)); buffers.push_back(asio::buffer(write_data) + 32); @@ -2939,8 +2939,8 @@ void test_4_arg_const_buffers_1_async_write_at() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); asio::const_buffers_1 buffers = asio::buffer(write_data, sizeof(write_data)); @@ -2949,8 +2949,8 @@ void test_4_arg_const_buffers_1_async_write_at() asio::async_write_at(s, 0, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -2959,8 +2959,8 @@ void test_4_arg_const_buffers_1_async_write_at() asio::async_write_at(s, 1234, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -2970,8 +2970,8 @@ void test_4_arg_const_buffers_1_async_write_at() asio::async_write_at(s, 0, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -2981,8 +2981,8 @@ void test_4_arg_const_buffers_1_async_write_at() asio::async_write_at(s, 1234, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -2992,8 +2992,8 @@ void test_4_arg_const_buffers_1_async_write_at() asio::async_write_at(s, 0, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -3003,8 +3003,8 @@ void test_4_arg_const_buffers_1_async_write_at() asio::async_write_at(s, 1234, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -3014,8 +3014,8 @@ void test_4_arg_const_buffers_1_async_write_at() asio::async_write_at(s, 0, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -3023,8 +3023,8 @@ void test_4_arg_const_buffers_1_async_write_at() int i = asio::async_write_at(s, 0, buffers, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); } @@ -3038,8 +3038,8 @@ void test_4_arg_mutable_buffers_1_async_write_at() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); asio::mutable_buffers_1 buffers = asio::buffer(mutable_write_data, sizeof(mutable_write_data)); @@ -3048,8 +3048,8 @@ void test_4_arg_mutable_buffers_1_async_write_at() asio::async_write_at(s, 0, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data))); @@ -3058,8 +3058,8 @@ void test_4_arg_mutable_buffers_1_async_write_at() asio::async_write_at(s, 1234, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data))); @@ -3069,8 +3069,8 @@ void test_4_arg_mutable_buffers_1_async_write_at() asio::async_write_at(s, 0, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data))); @@ -3080,8 +3080,8 @@ void test_4_arg_mutable_buffers_1_async_write_at() asio::async_write_at(s, 1234, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data))); @@ -3091,8 +3091,8 @@ void test_4_arg_mutable_buffers_1_async_write_at() asio::async_write_at(s, 0, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data))); @@ -3102,8 +3102,8 @@ void test_4_arg_mutable_buffers_1_async_write_at() asio::async_write_at(s, 1234, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data))); @@ -3113,8 +3113,8 @@ void test_4_arg_mutable_buffers_1_async_write_at() asio::async_write_at(s, 0, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data))); @@ -3122,8 +3122,8 @@ void test_4_arg_mutable_buffers_1_async_write_at() int i = asio::async_write_at(s, 0, buffers, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); } @@ -3138,8 +3138,8 @@ void test_4_arg_boost_array_buffers_async_write_at() #endif // defined(ASIO_HAS_BOOST_BIND) #if defined(ASIO_HAS_BOOST_ARRAY) - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); boost::array buffers = { { asio::buffer(write_data, 32), asio::buffer(write_data) + 32 } }; @@ -3149,8 +3149,8 @@ void test_4_arg_boost_array_buffers_async_write_at() asio::async_write_at(s, 0, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -3159,8 +3159,8 @@ void test_4_arg_boost_array_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -3170,8 +3170,8 @@ void test_4_arg_boost_array_buffers_async_write_at() asio::async_write_at(s, 0, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -3181,8 +3181,8 @@ void test_4_arg_boost_array_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -3192,8 +3192,8 @@ void test_4_arg_boost_array_buffers_async_write_at() asio::async_write_at(s, 0, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -3203,8 +3203,8 @@ void test_4_arg_boost_array_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -3214,8 +3214,8 @@ void test_4_arg_boost_array_buffers_async_write_at() asio::async_write_at(s, 0, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -3223,8 +3223,8 @@ void test_4_arg_boost_array_buffers_async_write_at() int i = asio::async_write_at(s, 0, buffers, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); #endif // defined(ASIO_HAS_BOOST_ARRAY) } @@ -3240,8 +3240,8 @@ void test_4_arg_std_array_buffers_async_write_at() #endif // defined(ASIO_HAS_BOOST_BIND) #if defined(ASIO_HAS_STD_ARRAY) - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); std::array buffers = { { asio::buffer(write_data, 32), asio::buffer(write_data) + 32 } }; @@ -3251,8 +3251,8 @@ void test_4_arg_std_array_buffers_async_write_at() asio::async_write_at(s, 0, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -3261,8 +3261,8 @@ void test_4_arg_std_array_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -3272,8 +3272,8 @@ void test_4_arg_std_array_buffers_async_write_at() asio::async_write_at(s, 0, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -3283,8 +3283,8 @@ void test_4_arg_std_array_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -3294,8 +3294,8 @@ void test_4_arg_std_array_buffers_async_write_at() asio::async_write_at(s, 0, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -3305,8 +3305,8 @@ void test_4_arg_std_array_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -3316,8 +3316,8 @@ void test_4_arg_std_array_buffers_async_write_at() asio::async_write_at(s, 0, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -3325,8 +3325,8 @@ void test_4_arg_std_array_buffers_async_write_at() int i = asio::async_write_at(s, 0, buffers, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); #endif // defined(ASIO_HAS_STD_ARRAY) } @@ -3341,8 +3341,8 @@ void test_4_arg_vector_buffers_async_write_at() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); std::vector buffers; buffers.push_back(asio::buffer(write_data, 32)); buffers.push_back(asio::buffer(write_data) + 32); @@ -3352,8 +3352,8 @@ void test_4_arg_vector_buffers_async_write_at() asio::async_write_at(s, 0, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -3362,8 +3362,8 @@ void test_4_arg_vector_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -3373,8 +3373,8 @@ void test_4_arg_vector_buffers_async_write_at() asio::async_write_at(s, 0, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -3384,8 +3384,8 @@ void test_4_arg_vector_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -3395,8 +3395,8 @@ void test_4_arg_vector_buffers_async_write_at() asio::async_write_at(s, 0, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -3406,8 +3406,8 @@ void test_4_arg_vector_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -3417,8 +3417,8 @@ void test_4_arg_vector_buffers_async_write_at() asio::async_write_at(s, 0, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -3426,8 +3426,8 @@ void test_4_arg_vector_buffers_async_write_at() int i = asio::async_write_at(s, 0, buffers, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); } @@ -3441,8 +3441,8 @@ void test_4_arg_streambuf_async_write_at() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); asio::streambuf sb; asio::const_buffers_1 buffers = asio::buffer(write_data, sizeof(write_data)); @@ -3454,8 +3454,8 @@ void test_4_arg_streambuf_async_write_at() asio::async_write_at(s, 0, sb, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -3466,8 +3466,8 @@ void test_4_arg_streambuf_async_write_at() asio::async_write_at(s, 1234, sb, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -3479,8 +3479,8 @@ void test_4_arg_streambuf_async_write_at() asio::async_write_at(s, 0, sb, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -3492,8 +3492,8 @@ void test_4_arg_streambuf_async_write_at() asio::async_write_at(s, 1234, sb, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -3505,8 +3505,8 @@ void test_4_arg_streambuf_async_write_at() asio::async_write_at(s, 0, sb, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -3518,8 +3518,8 @@ void test_4_arg_streambuf_async_write_at() asio::async_write_at(s, 1234, sb, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -3531,8 +3531,8 @@ void test_4_arg_streambuf_async_write_at() asio::async_write_at(s, 0, sb, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -3542,8 +3542,8 @@ void test_4_arg_streambuf_async_write_at() int i = asio::async_write_at(s, 0, sb, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); } @@ -3557,8 +3557,8 @@ void test_5_arg_const_buffers_1_async_write_at() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); asio::const_buffers_1 buffers = asio::buffer(write_data, sizeof(write_data)); @@ -3568,8 +3568,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -3579,8 +3579,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -3591,8 +3591,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -3603,8 +3603,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -3615,8 +3615,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -3627,8 +3627,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -3638,8 +3638,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -3649,8 +3649,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -3661,8 +3661,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -3673,8 +3673,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -3685,8 +3685,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -3697,8 +3697,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -3708,8 +3708,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -3719,8 +3719,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -3731,8 +3731,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -3743,8 +3743,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -3755,8 +3755,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -3767,8 +3767,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -3778,8 +3778,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -3789,8 +3789,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -3801,8 +3801,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -3813,8 +3813,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -3825,8 +3825,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 50)); @@ -3837,8 +3837,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 50)); @@ -3848,8 +3848,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -3859,8 +3859,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -3871,8 +3871,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -3883,8 +3883,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -3895,8 +3895,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -3907,8 +3907,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -3918,8 +3918,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -3929,8 +3929,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -3941,8 +3941,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -3953,8 +3953,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -3965,8 +3965,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -3977,8 +3977,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -3988,8 +3988,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -3999,8 +3999,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -4011,8 +4011,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -4023,8 +4023,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -4035,8 +4035,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -4047,8 +4047,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -4057,8 +4057,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::async_write_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -4067,8 +4067,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::async_write_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -4078,8 +4078,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::async_write_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -4089,8 +4089,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::async_write_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -4100,8 +4100,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::async_write_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -4111,8 +4111,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::async_write_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -4121,8 +4121,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::async_write_at(s, 0, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -4131,8 +4131,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::async_write_at(s, 1234, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -4142,8 +4142,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::async_write_at(s, 0, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -4153,8 +4153,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::async_write_at(s, 1234, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -4164,8 +4164,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::async_write_at(s, 0, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -4175,8 +4175,8 @@ void test_5_arg_const_buffers_1_async_write_at() asio::async_write_at(s, 1234, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -4184,8 +4184,8 @@ void test_5_arg_const_buffers_1_async_write_at() int i = asio::async_write_at(s, 0, buffers, short_transfer, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); } @@ -4199,8 +4199,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); asio::mutable_buffers_1 buffers = asio::buffer(mutable_write_data, sizeof(mutable_write_data)); @@ -4210,8 +4210,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data))); @@ -4221,8 +4221,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data))); @@ -4233,8 +4233,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data))); @@ -4245,8 +4245,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data))); @@ -4257,8 +4257,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data))); @@ -4269,8 +4269,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data))); @@ -4280,8 +4280,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data))); @@ -4291,8 +4291,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data))); @@ -4303,8 +4303,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -4315,8 +4315,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -4327,8 +4327,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -4339,8 +4339,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -4350,8 +4350,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data))); @@ -4361,8 +4361,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data))); @@ -4373,8 +4373,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -4385,8 +4385,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -4397,8 +4397,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -4409,8 +4409,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -4420,8 +4420,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data))); @@ -4431,8 +4431,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data))); @@ -4443,8 +4443,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -4455,8 +4455,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -4467,8 +4467,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 50)); @@ -4479,8 +4479,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 50)); @@ -4490,8 +4490,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -4501,8 +4501,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -4513,8 +4513,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -4525,8 +4525,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -4537,8 +4537,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -4549,8 +4549,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -4560,8 +4560,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -4571,8 +4571,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -4583,8 +4583,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -4595,8 +4595,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -4607,8 +4607,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -4619,8 +4619,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -4630,8 +4630,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -4641,8 +4641,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -4653,8 +4653,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -4665,8 +4665,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -4677,8 +4677,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -4689,8 +4689,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -4699,8 +4699,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::async_write_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data))); @@ -4709,8 +4709,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::async_write_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data))); @@ -4720,8 +4720,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::async_write_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data))); @@ -4731,8 +4731,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::async_write_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data))); @@ -4742,8 +4742,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::async_write_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data))); @@ -4753,8 +4753,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::async_write_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data))); @@ -4763,8 +4763,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::async_write_at(s, 0, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data))); @@ -4773,8 +4773,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::async_write_at(s, 1234, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data))); @@ -4784,8 +4784,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::async_write_at(s, 0, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data))); @@ -4795,8 +4795,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::async_write_at(s, 1234, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data))); @@ -4806,8 +4806,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::async_write_at(s, 0, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data))); @@ -4817,8 +4817,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() asio::async_write_at(s, 1234, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data))); @@ -4826,8 +4826,8 @@ void test_5_arg_mutable_buffers_1_async_write_at() int i = asio::async_write_at(s, 0, buffers, short_transfer, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); } @@ -4842,8 +4842,8 @@ void test_5_arg_boost_array_buffers_async_write_at() #endif // defined(ASIO_HAS_BOOST_BIND) #if defined(ASIO_HAS_BOOST_ARRAY) - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); boost::array buffers = { { asio::buffer(write_data, 32), asio::buffer(write_data) + 32 } }; @@ -4854,8 +4854,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -4865,8 +4865,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -4877,8 +4877,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -4889,8 +4889,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -4901,8 +4901,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -4913,8 +4913,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -4924,8 +4924,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -4935,8 +4935,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -4947,8 +4947,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -4959,8 +4959,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -4971,8 +4971,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -4983,8 +4983,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -4994,8 +4994,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -5005,8 +5005,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -5017,8 +5017,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -5029,8 +5029,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -5041,8 +5041,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -5053,8 +5053,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -5064,8 +5064,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -5075,8 +5075,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -5087,8 +5087,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -5099,8 +5099,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -5111,8 +5111,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 50)); @@ -5123,8 +5123,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 50)); @@ -5134,8 +5134,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -5145,8 +5145,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -5157,8 +5157,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -5169,8 +5169,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -5181,8 +5181,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -5193,8 +5193,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -5204,8 +5204,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -5215,8 +5215,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -5227,8 +5227,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -5239,8 +5239,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -5251,8 +5251,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -5263,8 +5263,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -5274,8 +5274,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -5285,8 +5285,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -5297,8 +5297,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -5309,8 +5309,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -5321,8 +5321,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -5333,8 +5333,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -5343,8 +5343,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::async_write_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -5353,8 +5353,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -5364,8 +5364,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::async_write_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -5375,8 +5375,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -5386,8 +5386,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::async_write_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -5397,8 +5397,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -5407,8 +5407,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::async_write_at(s, 0, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -5417,8 +5417,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -5428,8 +5428,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::async_write_at(s, 0, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -5439,8 +5439,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -5450,8 +5450,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::async_write_at(s, 0, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -5461,8 +5461,8 @@ void test_5_arg_boost_array_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -5470,8 +5470,8 @@ void test_5_arg_boost_array_buffers_async_write_at() int i = asio::async_write_at(s, 0, buffers, short_transfer, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); #endif // defined(ASIO_HAS_BOOST_ARRAY) } @@ -5487,8 +5487,8 @@ void test_5_arg_std_array_buffers_async_write_at() #endif // defined(ASIO_HAS_BOOST_BIND) #if defined(ASIO_HAS_STD_ARRAY) - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); std::array buffers = { { asio::buffer(write_data, 32), asio::buffer(write_data) + 32 } }; @@ -5499,8 +5499,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -5510,8 +5510,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -5522,8 +5522,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -5534,8 +5534,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -5546,8 +5546,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -5558,8 +5558,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -5569,8 +5569,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -5580,8 +5580,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -5592,8 +5592,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -5604,8 +5604,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -5616,8 +5616,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -5628,8 +5628,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -5639,8 +5639,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -5650,8 +5650,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -5662,8 +5662,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -5674,8 +5674,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -5686,8 +5686,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -5698,8 +5698,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -5709,8 +5709,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -5720,8 +5720,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -5732,8 +5732,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -5744,8 +5744,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -5756,8 +5756,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 50)); @@ -5768,8 +5768,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 50)); @@ -5779,8 +5779,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -5790,8 +5790,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -5802,8 +5802,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -5814,8 +5814,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -5826,8 +5826,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -5838,8 +5838,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -5849,8 +5849,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -5860,8 +5860,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -5872,8 +5872,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -5884,8 +5884,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -5896,8 +5896,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -5908,8 +5908,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -5919,8 +5919,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -5930,8 +5930,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -5942,8 +5942,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -5954,8 +5954,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -5966,8 +5966,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -5978,8 +5978,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -5988,8 +5988,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::async_write_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -5998,8 +5998,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -6009,8 +6009,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::async_write_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -6020,8 +6020,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -6031,8 +6031,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::async_write_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -6042,8 +6042,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -6052,8 +6052,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::async_write_at(s, 0, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -6062,8 +6062,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -6073,8 +6073,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::async_write_at(s, 0, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -6084,8 +6084,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -6095,8 +6095,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::async_write_at(s, 0, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -6106,8 +6106,8 @@ void test_5_arg_std_array_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -6115,8 +6115,8 @@ void test_5_arg_std_array_buffers_async_write_at() int i = asio::async_write_at(s, 0, buffers, short_transfer, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); #endif // defined(ASIO_HAS_STD_ARRAY) } @@ -6131,8 +6131,8 @@ void test_5_arg_vector_buffers_async_write_at() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); std::vector buffers; buffers.push_back(asio::buffer(write_data, 32)); buffers.push_back(asio::buffer(write_data) + 32); @@ -6143,8 +6143,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -6154,8 +6154,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -6166,8 +6166,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -6178,8 +6178,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -6190,8 +6190,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -6202,8 +6202,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -6213,8 +6213,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -6224,8 +6224,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -6236,8 +6236,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -6248,8 +6248,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -6260,8 +6260,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -6272,8 +6272,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -6283,8 +6283,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -6294,8 +6294,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -6306,8 +6306,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -6318,8 +6318,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -6330,8 +6330,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -6342,8 +6342,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -6353,8 +6353,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -6364,8 +6364,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -6376,8 +6376,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -6388,8 +6388,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -6400,8 +6400,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 50)); @@ -6412,8 +6412,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 50)); @@ -6423,8 +6423,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -6434,8 +6434,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -6446,8 +6446,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -6458,8 +6458,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -6470,8 +6470,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -6482,8 +6482,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -6493,8 +6493,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -6504,8 +6504,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -6516,8 +6516,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -6528,8 +6528,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -6540,8 +6540,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -6552,8 +6552,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -6563,8 +6563,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -6574,8 +6574,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -6586,8 +6586,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -6598,8 +6598,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -6610,8 +6610,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -6622,8 +6622,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -6632,8 +6632,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::async_write_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -6642,8 +6642,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -6653,8 +6653,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::async_write_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -6664,8 +6664,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -6675,8 +6675,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::async_write_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -6686,8 +6686,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -6696,8 +6696,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::async_write_at(s, 0, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -6706,8 +6706,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -6717,8 +6717,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::async_write_at(s, 0, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -6728,8 +6728,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -6739,8 +6739,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::async_write_at(s, 0, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -6750,8 +6750,8 @@ void test_5_arg_vector_buffers_async_write_at() asio::async_write_at(s, 1234, buffers, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -6759,8 +6759,8 @@ void test_5_arg_vector_buffers_async_write_at() int i = asio::async_write_at(s, 0, buffers, short_transfer, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); } @@ -6774,8 +6774,8 @@ void test_5_arg_streambuf_async_write_at() using std::placeholders::_2; #endif // defined(ASIO_HAS_BOOST_BIND) - asio::io_service ios; - test_random_access_device s(ios); + asio::io_context ioc; + test_random_access_device s(ioc); asio::streambuf sb; asio::const_buffers_1 buffers = asio::buffer(write_data, sizeof(write_data)); @@ -6788,8 +6788,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -6801,8 +6801,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -6815,8 +6815,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -6829,8 +6829,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -6843,8 +6843,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -6857,8 +6857,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -6870,8 +6870,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -6883,8 +6883,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -6897,8 +6897,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -6911,8 +6911,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -6925,8 +6925,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -6939,8 +6939,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -6952,8 +6952,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -6965,8 +6965,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -6979,8 +6979,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -6993,8 +6993,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -7007,8 +7007,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -7021,8 +7021,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -7034,8 +7034,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -7047,8 +7047,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -7061,8 +7061,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -7075,8 +7075,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -7089,8 +7089,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 50)); @@ -7103,8 +7103,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 50, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 50)); @@ -7116,8 +7116,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -7129,8 +7129,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -7143,8 +7143,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -7157,8 +7157,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -7171,8 +7171,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 1)); @@ -7185,8 +7185,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 1)); @@ -7198,8 +7198,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -7211,8 +7211,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -7225,8 +7225,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -7239,8 +7239,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -7253,8 +7253,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 10)); @@ -7267,8 +7267,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 10)); @@ -7280,8 +7280,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -7293,8 +7293,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -7307,8 +7307,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -7321,8 +7321,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -7335,8 +7335,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, 42)); @@ -7349,8 +7349,8 @@ void test_5_arg_streambuf_async_write_at() asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, 42)); @@ -7361,8 +7361,8 @@ void test_5_arg_streambuf_async_write_at() asio::async_write_at(s, 0, sb, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -7373,8 +7373,8 @@ void test_5_arg_streambuf_async_write_at() asio::async_write_at(s, 1234, sb, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -7386,8 +7386,8 @@ void test_5_arg_streambuf_async_write_at() asio::async_write_at(s, 0, sb, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -7399,8 +7399,8 @@ void test_5_arg_streambuf_async_write_at() asio::async_write_at(s, 1234, sb, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -7412,8 +7412,8 @@ void test_5_arg_streambuf_async_write_at() asio::async_write_at(s, 0, sb, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -7425,8 +7425,8 @@ void test_5_arg_streambuf_async_write_at() asio::async_write_at(s, 1234, sb, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -7437,8 +7437,8 @@ void test_5_arg_streambuf_async_write_at() asio::async_write_at(s, 0, sb, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -7449,8 +7449,8 @@ void test_5_arg_streambuf_async_write_at() asio::async_write_at(s, 1234, sb, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -7462,8 +7462,8 @@ void test_5_arg_streambuf_async_write_at() asio::async_write_at(s, 0, sb, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -7475,8 +7475,8 @@ void test_5_arg_streambuf_async_write_at() asio::async_write_at(s, 1234, sb, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -7488,8 +7488,8 @@ void test_5_arg_streambuf_async_write_at() asio::async_write_at(s, 0, sb, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); @@ -7501,8 +7501,8 @@ void test_5_arg_streambuf_async_write_at() asio::async_write_at(s, 1234, sb, short_transfer, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(called); ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data))); @@ -7512,8 +7512,8 @@ void test_5_arg_streambuf_async_write_at() int i = asio::async_write_at(s, 0, sb, short_transfer, archetypes::lazy_handler()); ASIO_CHECK(i == 42); - ios.restart(); - ios.run(); + ioc.restart(); + ioc.run(); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); }