summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/asio/include/asio/detail/wait_handler.hpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/asio/include/asio/detail/wait_handler.hpp')
-rw-r--r--3rdparty/asio/include/asio/detail/wait_handler.hpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/3rdparty/asio/include/asio/detail/wait_handler.hpp b/3rdparty/asio/include/asio/detail/wait_handler.hpp
index 29bcfd75f1c..489a968cd77 100644
--- a/3rdparty/asio/include/asio/detail/wait_handler.hpp
+++ b/3rdparty/asio/include/asio/detail/wait_handler.hpp
@@ -2,7 +2,7 @@
// detail/wait_handler.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2024 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)
@@ -16,29 +16,29 @@
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include "asio/detail/config.hpp"
+#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/wait_op.hpp"
-#include "asio/io_context.hpp"
#include "asio/detail/push_options.hpp"
namespace asio {
namespace detail {
-template <typename Handler>
+template <typename Handler, typename IoExecutor>
class wait_handler : public wait_op
{
public:
ASIO_DEFINE_HANDLER_PTR(wait_handler);
- wait_handler(Handler& h)
+ wait_handler(Handler& h, const IoExecutor& io_ex)
: wait_op(&wait_handler::do_complete),
- handler_(ASIO_MOVE_CAST(Handler)(h))
+ handler_(static_cast<Handler&&>(h)),
+ work_(handler_, io_ex)
{
- handler_work<Handler>::start(handler_);
}
static void do_complete(void* owner, operation* base,
@@ -48,10 +48,14 @@ public:
// Take ownership of the handler object.
wait_handler* h(static_cast<wait_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(
+ static_cast<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
@@ -75,6 +79,7 @@ public:
private:
Handler handler_;
+ handler_work<Handler, IoExecutor> work_;
};
} // namespace detail