2 // detail/scheduler_operation.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 // Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_ASIO_DETAIL_SCHEDULER_OPERATION_HPP
12 #define BOOST_ASIO_DETAIL_SCHEDULER_OPERATION_HPP
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18 #include <boost/system/error_code.hpp>
19 #include <boost/asio/detail/handler_tracking.hpp>
20 #include <boost/asio/detail/op_queue.hpp>
22 #include <boost/asio/detail/push_options.hpp>
30 // Base class for all operations. A function pointer is used instead of virtual
31 // functions to avoid the associated overhead.
32 class scheduler_operation BOOST_ASIO_INHERIT_TRACKED_HANDLER
35 typedef scheduler_operation operation_type;
37 void complete(void* owner, const boost::system::error_code& ec,
38 std::size_t bytes_transferred)
40 func_(owner, this, ec, bytes_transferred);
45 func_(0, this, boost::system::error_code(), 0);
49 typedef void (*func_type)(void*,
51 const boost::system::error_code&, std::size_t);
53 scheduler_operation(func_type func)
60 // Prevents deletion through this type.
61 ~scheduler_operation()
66 friend class op_queue_access;
67 scheduler_operation* next_;
70 friend class scheduler;
71 unsigned int task_result_; // Passed into bytes transferred.
78 #include <boost/asio/detail/pop_options.hpp>
80 #endif // BOOST_ASIO_DETAIL_SCHEDULER_OPERATION_HPP