X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Fboost%2Fboost%2Fasio%2Fdetail%2Fwin_iocp_overlapped_ptr.hpp;h=d1ed1cb1a0e8a6479dda95b9aab737191fc42a3e;hb=92f5a8d42d07f9929ae4fa7e01342fe8d96808a8;hp=6cff7ae1d4aa79f7e3fe9674c34abc12660f580a;hpb=a0324939f9d0e1905d5df8f57442f09dc70af83d;p=ceph.git diff --git a/ceph/src/boost/boost/asio/detail/win_iocp_overlapped_ptr.hpp b/ceph/src/boost/boost/asio/detail/win_iocp_overlapped_ptr.hpp index 6cff7ae1d..d1ed1cb1a 100644 --- a/ceph/src/boost/boost/asio/detail/win_iocp_overlapped_ptr.hpp +++ b/ceph/src/boost/boost/asio/detail/win_iocp_overlapped_ptr.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_overlapped_ptr.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2019 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) @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -45,13 +46,13 @@ public: } // Construct an win_iocp_overlapped_ptr to contain the specified handler. - template - explicit win_iocp_overlapped_ptr( - boost::asio::io_context& io_context, BOOST_ASIO_MOVE_ARG(Handler) handler) + template + explicit win_iocp_overlapped_ptr(const Executor& ex, + BOOST_ASIO_MOVE_ARG(Handler) handler) : ptr_(0), iocp_service_(0) { - this->reset(io_context, BOOST_ASIO_MOVE_CAST(Handler)(handler)); + this->reset(ex, BOOST_ASIO_MOVE_CAST(Handler)(handler)); } // Destructor automatically frees the OVERLAPPED object unless released. @@ -74,22 +75,25 @@ public: // Reset to contain the specified handler, freeing any current OVERLAPPED // object. - template - void reset(boost::asio::io_context& io_context, Handler handler) + template + void reset(const Executor& ex, Handler handler) { - typedef win_iocp_overlapped_op op; + const bool native = is_same::value; + win_iocp_io_context* iocp_service = this->get_iocp_service(ex); + + typedef win_iocp_overlapped_op > op; typename op::ptr p = { boost::asio::detail::addressof(handler), op::ptr::allocate(handler), 0 }; - p.p = new (p.v) op(handler); + p.p = new (p.v) op(handler, io_object_executor(ex, native)); - BOOST_ASIO_HANDLER_CREATION((io_context, *p.p, - "io_context", &io_context.impl_, 0, "overlapped")); + BOOST_ASIO_HANDLER_CREATION((ex.context(), *p.p, + "iocp_service", iocp_service, 0, "overlapped")); - io_context.impl_.work_started(); + iocp_service->work_started(); reset(); ptr_ = p.p; p.v = p.p = 0; - iocp_service_ = &io_context.impl_; + iocp_service_ = iocp_service; } // Get the contained OVERLAPPED object. @@ -130,6 +134,18 @@ public: } private: + template + static win_iocp_io_context* get_iocp_service(const Executor& ex) + { + return &use_service(ex.context()); + } + + static win_iocp_io_context* get_iocp_service( + const io_context::executor_type& ex) + { + return &ex.context().impl_; + } + win_iocp_operation* ptr_; win_iocp_io_context* iocp_service_; };