]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/asio/detail/win_iocp_overlapped_op.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / asio / detail / win_iocp_overlapped_op.hpp
index 57bbe2df0e4160f5405ac953dc90f740db1a0071..be3f29297e8cce1b150e6d7421f4ad5e6c2a6ce9 100644 (file)
 
 #if defined(BOOST_ASIO_HAS_IOCP)
 
-#include <boost/asio/error.hpp>
 #include <boost/asio/detail/bind_handler.hpp>
 #include <boost/asio/detail/fenced_block.hpp>
 #include <boost/asio/detail/handler_alloc_helpers.hpp>
 #include <boost/asio/detail/handler_invoke_helpers.hpp>
+#include <boost/asio/detail/handler_work.hpp>
 #include <boost/asio/detail/memory.hpp>
 #include <boost/asio/detail/operation.hpp>
+#include <boost/asio/error.hpp>
 
 #include <boost/asio/detail/push_options.hpp>
 
@@ -42,9 +43,8 @@ public:
   win_iocp_overlapped_op(Handler& handler, const IoExecutor& io_ex)
     : operation(&win_iocp_overlapped_op::do_complete),
       handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
-      io_executor_(io_ex)
+      work_(handler_, io_ex)
   {
-    handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
   }
 
   static void do_complete(void* owner, operation* base,
@@ -53,10 +53,14 @@ public:
     // Take ownership of the operation object.
     win_iocp_overlapped_op* o(static_cast<win_iocp_overlapped_op*>(base));
     ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
-    handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
 
     BOOST_ASIO_HANDLER_COMPLETION((*o));
 
+    // Take ownership of the operation's outstanding work.
+    handler_work<Handler, IoExecutor> w(
+        BOOST_ASIO_MOVE_CAST2(handler_work<Handler, IoExecutor>)(
+          o->work_));
+
     // Make a copy of the handler so that the memory can be deallocated before
     // the upcall is made. Even if we're not about to make an upcall, a
     // sub-object of the handler may be the true owner of the memory associated
@@ -80,7 +84,7 @@ public:
 
 private:
   Handler handler_;
-  IoExecutor io_executor_;
+  handler_work<Handler, IoExecutor> work_;
 };
 
 } // namespace detail