// impl/executor.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)
#include <boost/asio/detail/config.hpp>
#include <boost/asio/detail/atomic_count.hpp>
-#include <boost/asio/detail/executor_op.hpp>
+#include <boost/asio/detail/executor_function.hpp>
#include <boost/asio/detail/global.hpp>
#include <boost/asio/detail/memory.hpp>
#include <boost/asio/detail/recycling_allocator.hpp>
explicit function(F f, const Alloc& a)
{
// Allocate and construct an operation to wrap the function.
- typedef detail::executor_op<F, Alloc> op;
- typename op::ptr p = { detail::addressof(a), op::ptr::allocate(a), 0 };
- op_ = new (p.v) op(BOOST_ASIO_MOVE_CAST(F)(f), a);
+ typedef detail::executor_function<F, Alloc> func_type;
+ typename func_type::ptr p = {
+ detail::addressof(a), func_type::ptr::allocate(a), 0 };
+ func_ = new (p.v) func_type(BOOST_ASIO_MOVE_CAST(F)(f), a);
p.v = 0;
}
- function(function&& other)
- : op_(other.op_)
+ function(function&& other) BOOST_ASIO_NOEXCEPT
+ : func_(other.func_)
{
- other.op_ = 0;
+ other.func_ = 0;
}
~function()
{
- if (op_)
- op_->destroy();
+ if (func_)
+ func_->destroy();
}
void operator()()
{
- if (op_)
+ if (func_)
{
- detail::scheduler_operation* op = op_;
- op_ = 0;
- op->complete(this, boost::system::error_code(), 0);
+ detail::executor_function_base* func = func_;
+ func_ = 0;
+ func->complete();
}
}
private:
- detail::scheduler_operation* op_;
+ detail::executor_function_base* func_;
};
#else // defined(BOOST_ASIO_HAS_MOVE)