summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/asio/include/asio/detail/signal_handler.hpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/asio/include/asio/detail/signal_handler.hpp')
-rw-r--r--3rdparty/asio/include/asio/detail/signal_handler.hpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/3rdparty/asio/include/asio/detail/signal_handler.hpp b/3rdparty/asio/include/asio/detail/signal_handler.hpp
index 19fee65c0e4..0153133f1de 100644
--- a/3rdparty/asio/include/asio/detail/signal_handler.hpp
+++ b/3rdparty/asio/include/asio/detail/signal_handler.hpp
@@ -2,7 +2,7 @@
// detail/signal_handler.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2021 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)
@@ -19,7 +19,6 @@
#include "asio/detail/bind_handler.hpp"
#include "asio/detail/fenced_block.hpp"
#include "asio/detail/handler_alloc_helpers.hpp"
-#include "asio/detail/handler_invoke_helpers.hpp"
#include "asio/detail/handler_work.hpp"
#include "asio/detail/memory.hpp"
#include "asio/detail/signal_op.hpp"
@@ -29,17 +28,17 @@
namespace asio {
namespace detail {
-template <typename Handler>
+template <typename Handler, typename IoExecutor>
class signal_handler : public signal_op
{
public:
ASIO_DEFINE_HANDLER_PTR(signal_handler);
- signal_handler(Handler& h)
+ signal_handler(Handler& h, const IoExecutor& io_ex)
: signal_op(&signal_handler::do_complete),
- handler_(ASIO_MOVE_CAST(Handler)(h))
+ handler_(ASIO_MOVE_CAST(Handler)(h)),
+ work_(handler_, io_ex)
{
- handler_work<Handler>::start(handler_);
}
static void do_complete(void* owner, operation* base,
@@ -49,10 +48,14 @@ public:
// Take ownership of the handler object.
signal_handler* h(static_cast<signal_handler*>(base));
ptr p = { asio::detail::addressof(h->handler_), h, h };
- handler_work<Handler> w(h->handler_);
ASIO_HANDLER_COMPLETION((*h));
+ // Take ownership of the operation's outstanding work.
+ handler_work<Handler, IoExecutor> w(
+ ASIO_MOVE_CAST2(handler_work<Handler, IoExecutor>)(
+ h->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
@@ -76,6 +79,7 @@ public:
private:
Handler handler_;
+ handler_work<Handler, IoExecutor> work_;
};
} // namespace detail