]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/asio/detail/signal_set_service.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / asio / detail / signal_set_service.hpp
index 17ae44ea378056dabf72780a03e24143a52917a2..baaf856349d4bed0fec55442982acb1eba142679 100644 (file)
@@ -2,7 +2,7 @@
 // detail/signal_set_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)
 //
 // 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)
@@ -20,7 +20,7 @@
 #include <cstddef>
 #include <signal.h>
 #include <boost/asio/error.hpp>
-#include <boost/asio/io_context.hpp>
+#include <boost/asio/execution_context.hpp>
 #include <boost/asio/detail/handler_alloc_helpers.hpp>
 #include <boost/asio/detail/memory.hpp>
 #include <boost/asio/detail/op_queue.hpp>
 #include <boost/asio/detail/signal_op.hpp>
 #include <boost/asio/detail/socket_types.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)
+
 #if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
 # include <boost/asio/detail/reactor.hpp>
 #endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
@@ -49,7 +55,7 @@ extern BOOST_ASIO_DECL struct signal_state* get_signal_state();
 extern "C" BOOST_ASIO_DECL void boost_asio_signal_handler(int signal_number);
 
 class signal_set_service :
-  public service_base<signal_set_service>
+  public execution_context_service_base<signal_set_service>
 {
 public:
   // Type used for tracking an individual signal registration.
@@ -110,7 +116,7 @@ public:
   };
 
   // Constructor.
-  BOOST_ASIO_DECL signal_set_service(boost::asio::io_context& io_context);
+  BOOST_ASIO_DECL signal_set_service(execution_context& context);
 
   // Destructor.
   BOOST_ASIO_DECL ~signal_set_service();
@@ -120,7 +126,7 @@ public:
 
   // Perform fork-related housekeeping.
   BOOST_ASIO_DECL void notify_fork(
-      boost::asio::io_context::fork_event fork_ev);
+      boost::asio::execution_context::fork_event fork_ev);
 
   // Construct a new signal_set implementation.
   BOOST_ASIO_DECL void construct(implementation_type& impl);
@@ -145,16 +151,17 @@ public:
       boost::system::error_code& ec);
 
   // Start an asynchronous operation to wait for a signal to be delivered.
-  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 signal_handler<Handler> op;
+    typedef signal_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(),
+    BOOST_ASIO_HANDLER_CREATION((scheduler_.context(),
           *p.p, "signal_set", &impl, 0, "async_wait"));
 
     start_wait_op(impl, p.p);
@@ -180,8 +187,13 @@ private:
   // Helper function to start a wait operation.
   BOOST_ASIO_DECL void start_wait_op(implementation_type& impl, signal_op* op);
 
-  // The io_context instance used for dispatching handlers.
-  io_context_impl& io_context_;
+  // The scheduler used for dispatching handlers.
+#if defined(BOOST_ASIO_HAS_IOCP)
+  typedef class win_iocp_io_context scheduler_impl;
+#else
+  typedef class scheduler scheduler_impl;
+#endif
+  scheduler_impl& scheduler_;
 
 #if !defined(BOOST_ASIO_WINDOWS) \
   && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \