diff options
Diffstat (limited to 'boost/asio/detail/win_iocp_overlapped_ptr.hpp')
-rw-r--r-- | boost/asio/detail/win_iocp_overlapped_ptr.hpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/boost/asio/detail/win_iocp_overlapped_ptr.hpp b/boost/asio/detail/win_iocp_overlapped_ptr.hpp index 5d252c6fb1..fc51fd6c59 100644 --- a/boost/asio/detail/win_iocp_overlapped_ptr.hpp +++ b/boost/asio/detail/win_iocp_overlapped_ptr.hpp @@ -19,12 +19,12 @@ #if defined(BOOST_ASIO_HAS_IOCP) -#include <boost/asio/io_service.hpp> -#include <boost/asio/detail/addressof.hpp> +#include <boost/asio/io_context.hpp> #include <boost/asio/detail/handler_alloc_helpers.hpp> +#include <boost/asio/detail/memory.hpp> #include <boost/asio/detail/noncopyable.hpp> #include <boost/asio/detail/win_iocp_overlapped_op.hpp> -#include <boost/asio/detail/win_iocp_io_service.hpp> +#include <boost/asio/detail/win_iocp_io_context.hpp> #include <boost/asio/detail/push_options.hpp> @@ -47,11 +47,11 @@ public: // Construct an win_iocp_overlapped_ptr to contain the specified handler. template <typename Handler> explicit win_iocp_overlapped_ptr( - boost::asio::io_service& io_service, BOOST_ASIO_MOVE_ARG(Handler) handler) + boost::asio::io_context& io_context, BOOST_ASIO_MOVE_ARG(Handler) handler) : ptr_(0), iocp_service_(0) { - this->reset(io_service, BOOST_ASIO_MOVE_CAST(Handler)(handler)); + this->reset(io_context, BOOST_ASIO_MOVE_CAST(Handler)(handler)); } // Destructor automatically frees the OVERLAPPED object unless released. @@ -75,22 +75,21 @@ public: // Reset to contain the specified handler, freeing any current OVERLAPPED // object. template <typename Handler> - void reset(boost::asio::io_service& io_service, Handler handler) + void reset(boost::asio::io_context& io_context, Handler handler) { typedef win_iocp_overlapped_op<Handler> op; typename op::ptr p = { boost::asio::detail::addressof(handler), - boost_asio_handler_alloc_helpers::allocate( - sizeof(op), handler), 0 }; + op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(handler); - BOOST_ASIO_HANDLER_CREATION((p.p, "io_service", - &io_service.impl_, "overlapped")); + BOOST_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. @@ -132,7 +131,7 @@ public: private: win_iocp_operation* ptr_; - win_iocp_io_service* iocp_service_; + win_iocp_io_context* iocp_service_; }; } // namespace detail |