#if defined(BOOST_ASIO_HAS_IOCP)
#include <boost/asio/detail/bind_handler.hpp>
-#include <boost/asio/detail/buffer_sequence_adapter.hpp>
#include <boost/asio/detail/fenced_block.hpp>
#include <boost/asio/detail/handler_alloc_helpers.hpp>
#include <boost/asio/detail/handler_invoke_helpers.hpp>
+#include <boost/asio/detail/handler_work.hpp>
#include <boost/asio/detail/memory.hpp>
#include <boost/asio/detail/reactor_op.hpp>
#include <boost/asio/detail/socket_ops.hpp>
win_iocp_null_buffers_op(socket_ops::weak_cancel_token_type cancel_token,
Handler& handler, const IoExecutor& io_ex)
- : reactor_op(&win_iocp_null_buffers_op::do_perform,
+ : reactor_op(boost::system::error_code(),
+ &win_iocp_null_buffers_op::do_perform,
&win_iocp_null_buffers_op::do_complete),
cancel_token_(cancel_token),
handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
- io_executor_(io_ex)
+ work_(handler_, io_ex)
{
- handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static status do_perform(reactor_op*)
// Take ownership of the operation object.
win_iocp_null_buffers_op* o(static_cast<win_iocp_null_buffers_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*o));
+ // Take ownership of the operation's outstanding work.
+ handler_work<Handler, IoExecutor> w(
+ BOOST_ASIO_MOVE_CAST2(handler_work<Handler, IoExecutor>)(
+ o->work_));
+
// The reactor may have stored a result in the operation object.
if (o->ec_)
ec = o->ec_;
private:
socket_ops::weak_cancel_token_type cancel_token_;
Handler handler_;
- IoExecutor io_executor_;
+ handler_work<Handler, IoExecutor> work_;
};
} // namespace detail