2 // detail/win_iocp_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_WIN_IOCP_OPERATION_HPP
12 #define BOOST_ASIO_DETAIL_WIN_IOCP_OPERATION_HPP
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18 #include <boost/asio/detail/config.hpp>
20 #if defined(BOOST_ASIO_HAS_IOCP)
22 #include <boost/asio/detail/handler_tracking.hpp>
23 #include <boost/asio/detail/op_queue.hpp>
24 #include <boost/asio/detail/socket_types.hpp>
25 #include <boost/system/error_code.hpp>
27 #include <boost/asio/detail/push_options.hpp>
33 class win_iocp_io_context;
35 // Base class for all operations. A function pointer is used instead of virtual
36 // functions to avoid the associated overhead.
37 class win_iocp_operation
39 BOOST_ASIO_ALSO_INHERIT_TRACKED_HANDLER
42 typedef win_iocp_operation operation_type;
44 void complete(void* owner, const boost::system::error_code& ec,
45 std::size_t bytes_transferred)
47 func_(owner, this, ec, bytes_transferred);
52 func_(0, this, boost::system::error_code(), 0);
56 typedef void (*func_type)(
57 void*, win_iocp_operation*,
58 const boost::system::error_code&, std::size_t);
60 win_iocp_operation(func_type func)
67 // Prevents deletion through this type.
83 friend class op_queue_access;
84 friend class win_iocp_io_context;
85 win_iocp_operation* next_;
94 #include <boost/asio/detail/pop_options.hpp>
96 #endif // defined(BOOST_ASIO_HAS_IOCP)
98 #endif // BOOST_ASIO_DETAIL_WIN_IOCP_OPERATION_HPP