diff options
Diffstat (limited to 'boost/asio/windows/object_handle_service.hpp')
-rw-r--r-- | boost/asio/windows/object_handle_service.hpp | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/boost/asio/windows/object_handle_service.hpp b/boost/asio/windows/object_handle_service.hpp index 26ef6ed507..6932d43c2b 100644 --- a/boost/asio/windows/object_handle_service.hpp +++ b/boost/asio/windows/object_handle_service.hpp @@ -18,13 +18,15 @@ #include <boost/asio/detail/config.hpp> +#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) + #if defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) \ || defined(GENERATING_DOCUMENTATION) #include <boost/asio/async_result.hpp> #include <boost/asio/detail/win_object_handle_service.hpp> #include <boost/asio/error.hpp> -#include <boost/asio/io_service.hpp> +#include <boost/asio/io_context.hpp> #include <boost/asio/detail/push_options.hpp> @@ -35,7 +37,7 @@ namespace windows { /// Default service implementation for an object handle. class object_handle_service #if defined(GENERATING_DOCUMENTATION) - : public boost::asio::io_service::service + : public boost::asio::io_context::service #else : public boost::asio::detail::service_base<object_handle_service> #endif @@ -43,7 +45,7 @@ class object_handle_service public: #if defined(GENERATING_DOCUMENTATION) /// The unique service identifier. - static boost::asio::io_service::id id; + static boost::asio::io_context::id id; #endif private: @@ -65,10 +67,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(boost::asio::io_service& io_service) - : boost::asio::detail::service_base<object_handle_service>(io_service), - service_impl_(io_service) + /// Construct a new object handle service for the specified io_context. + explicit object_handle_service(boost::asio::io_context& io_context) + : boost::asio::detail::service_base<object_handle_service>(io_context), + service_impl_(io_context) { } @@ -102,10 +104,11 @@ public: } /// Assign an existing native handle to an object handle. - boost::system::error_code assign(implementation_type& impl, + BOOST_ASIO_SYNC_OP_VOID assign(implementation_type& impl, const native_handle_type& handle, boost::system::error_code& ec) { - return service_impl_.assign(impl, handle, ec); + service_impl_.assign(impl, handle, ec); + BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); } /// Determine whether the handle is open. @@ -115,10 +118,11 @@ public: } /// Close an object handle implementation. - boost::system::error_code close(implementation_type& impl, + BOOST_ASIO_SYNC_OP_VOID close(implementation_type& impl, boost::system::error_code& ec) { - return service_impl_.close(impl, ec); + service_impl_.close(impl, ec); + BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); } /// Get the native handle implementation. @@ -128,10 +132,11 @@ public: } /// Cancel all asynchronous operations associated with the handle. - boost::system::error_code cancel(implementation_type& impl, + BOOST_ASIO_SYNC_OP_VOID cancel(implementation_type& impl, boost::system::error_code& ec) { - return service_impl_.cancel(impl, ec); + service_impl_.cancel(impl, ec); + BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); } // Wait for a signaled state. @@ -147,20 +152,19 @@ public: async_wait(implementation_type& impl, BOOST_ASIO_MOVE_ARG(WaitHandler) handler) { - boost::asio::detail::async_result_init< - WaitHandler, void (boost::system::error_code)> init( - BOOST_ASIO_MOVE_CAST(WaitHandler)(handler)); + boost::asio::async_completion<WaitHandler, + void (boost::system::error_code)> init(handler); - service_impl_.async_wait(impl, init.handler); + service_impl_.async_wait(impl, init.completion_handler); return init.result.get(); } private: // Destroy all user-defined handler objects owned by the service. - void shutdown_service() + void shutdown() { - service_impl_.shutdown_service(); + service_impl_.shutdown(); } // The platform-specific implementation. @@ -176,4 +180,6 @@ private: #endif // defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) // || defined(GENERATING_DOCUMENTATION) +#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) + #endif // BOOST_ASIO_WINDOWS_OBJECT_HANDLE_SERVICE_HPP |