2 // detail/task_io_service_operation.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 // Copyright (c) 2003-2016 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_TASK_IO_SERVICE_OPERATION_HPP
12 #define BOOST_ASIO_DETAIL_TASK_IO_SERVICE_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>
28 class task_io_service;
30 // Base class for all operations. A function pointer is used instead of virtual
31 // functions to avoid the associated overhead.
32 class task_io_service_operation BOOST_ASIO_INHERIT_TRACKED_HANDLER
35 void complete(task_io_service& owner,
36 const boost::system::error_code& ec, std::size_t bytes_transferred)
38 func_(&owner, this, ec, bytes_transferred);
43 func_(0, this, boost::system::error_code(), 0);
47 typedef void (*func_type)(task_io_service*,
48 task_io_service_operation*,
49 const boost::system::error_code&, std::size_t);
51 task_io_service_operation(func_type func)
58 // Prevents deletion through this type.
59 ~task_io_service_operation()
64 friend class op_queue_access;
65 task_io_service_operation* next_;
68 friend class task_io_service;
69 unsigned int task_result_; // Passed into bytes transferred.
76 #include <boost/asio/detail/pop_options.hpp>
78 #endif // BOOST_ASIO_DETAIL_TASK_IO_SERVICE_OPERATION_HPP