]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/asio/detail/win_object_handle_service.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / asio / detail / win_object_handle_service.hpp
index 03fb6348887073ad42dd8ca6a86b6c592b523903..42032224a831a5fd8c7ba3dfba38fe71e55b6929 100644 (file)
@@ -2,7 +2,7 @@
 // detail/win_object_handle_service.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)
 // Copyright (c) 2011 Boris Schaeling (boris@highscore.de)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 #include <boost/asio/detail/memory.hpp>
 #include <boost/asio/detail/wait_handler.hpp>
 #include <boost/asio/error.hpp>
-#include <boost/asio/io_context.hpp>
+#include <boost/asio/execution_context.hpp>
+
+#if defined(BOOST_ASIO_HAS_IOCP)
+# include <boost/asio/detail/win_iocp_io_context.hpp>
+#else // defined(BOOST_ASIO_HAS_IOCP)
+# include <boost/asio/detail/scheduler.hpp>
+#endif // defined(BOOST_ASIO_HAS_IOCP)
 
 #include <boost/asio/detail/push_options.hpp>
 
@@ -33,7 +39,7 @@ namespace asio {
 namespace detail {
 
 class win_object_handle_service :
-  public service_base<win_object_handle_service>
+  public execution_context_service_base<win_object_handle_service>
 {
 public:
   // The native type of an object handle.
@@ -80,8 +86,7 @@ public:
   };
 
   // Constructor.
-  BOOST_ASIO_DECL win_object_handle_service(
-      boost::asio::io_context& io_context);
+  BOOST_ASIO_DECL win_object_handle_service(execution_context& context);
 
   // Destroy all user-defined handler objects owned by the service.
   BOOST_ASIO_DECL void shutdown();
@@ -130,16 +135,17 @@ public:
       boost::system::error_code& ec);
 
   /// Start an asynchronous wait.
-  template <typename Handler>
-  void async_wait(implementation_type& impl, Handler& handler)
+  template <typename Handler, typename IoExecutor>
+  void async_wait(implementation_type& impl,
+      Handler& handler, const IoExecutor& io_ex)
   {
     // Allocate and construct an operation to wrap the handler.
-    typedef wait_handler<Handler> op;
+    typedef wait_handler<Handler, IoExecutor> 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_ex);
 
-    BOOST_ASIO_HANDLER_CREATION((io_context_.context(), *p.p, "object_handle",
+    BOOST_ASIO_HANDLER_CREATION((scheduler_.context(), *p.p, "object_handle",
           &impl, reinterpret_cast<uintmax_t>(impl.wait_handle_), "async_wait"));
 
     start_wait_op(impl, p.p);
@@ -158,8 +164,13 @@ private:
   static BOOST_ASIO_DECL VOID CALLBACK wait_callback(
       PVOID param, BOOLEAN timeout);
 
-  // The io_context implementation used to post completions.
-  io_context_impl& io_context_;
+  // The scheduler used to post completions.
+#if defined(BOOST_ASIO_HAS_IOCP)
+  typedef class win_iocp_io_context scheduler_impl;
+#else
+  typedef class scheduler scheduler_impl;
+#endif
+  scheduler_impl& scheduler_;
 
   // Mutex to protect access to internal state.
   mutex mutex_;