summaryrefslogtreecommitdiff
path: root/boost/asio/detail/signal_set_service.hpp
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2019-12-05 15:22:41 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2019-12-05 15:22:41 +0900
commit3c1df2168531ad5580076ae08d529054689aeedd (patch)
tree941aff6f86393eecacddfec252a8508c7e8351c9 /boost/asio/detail/signal_set_service.hpp
parentd6a306e745acfee00e81ccaf3324a2a03516db41 (diff)
downloadboost-3c1df2168531ad5580076ae08d529054689aeedd.tar.gz
boost-3c1df2168531ad5580076ae08d529054689aeedd.tar.bz2
boost-3c1df2168531ad5580076ae08d529054689aeedd.zip
Imported Upstream version 1.70.0upstream/1.70.0
Diffstat (limited to 'boost/asio/detail/signal_set_service.hpp')
-rw-r--r--boost/asio/detail/signal_set_service.hpp36
1 files changed, 24 insertions, 12 deletions
diff --git a/boost/asio/detail/signal_set_service.hpp b/boost/asio/detail/signal_set_service.hpp
index 17ae44ea37..baaf856349 100644
--- a/boost/asio/detail/signal_set_service.hpp
+++ b/boost/asio/detail/signal_set_service.hpp
@@ -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>
@@ -28,6 +28,12 @@
#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) \