]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/asio/include/boost/asio/detail/win_iocp_operation.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / asio / include / boost / asio / detail / win_iocp_operation.hpp
1 //
2 // detail/win_iocp_operation.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 //
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)
9 //
10
11 #ifndef BOOST_ASIO_DETAIL_WIN_IOCP_OPERATION_HPP
12 #define BOOST_ASIO_DETAIL_WIN_IOCP_OPERATION_HPP
13
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17
18 #include <boost/asio/detail/config.hpp>
19
20 #if defined(BOOST_ASIO_HAS_IOCP)
21
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>
26
27 #include <boost/asio/detail/push_options.hpp>
28
29 namespace boost {
30 namespace asio {
31 namespace detail {
32
33 class win_iocp_io_service;
34
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
38 : public OVERLAPPED
39 BOOST_ASIO_ALSO_INHERIT_TRACKED_HANDLER
40 {
41 public:
42 void complete(win_iocp_io_service& owner,
43 const boost::system::error_code& ec,
44 std::size_t bytes_transferred)
45 {
46 func_(&owner, this, ec, bytes_transferred);
47 }
48
49 void destroy()
50 {
51 func_(0, this, boost::system::error_code(), 0);
52 }
53
54 protected:
55 typedef void (*func_type)(
56 win_iocp_io_service*, win_iocp_operation*,
57 const boost::system::error_code&, std::size_t);
58
59 win_iocp_operation(func_type func)
60 : next_(0),
61 func_(func)
62 {
63 reset();
64 }
65
66 // Prevents deletion through this type.
67 ~win_iocp_operation()
68 {
69 }
70
71 void reset()
72 {
73 Internal = 0;
74 InternalHigh = 0;
75 Offset = 0;
76 OffsetHigh = 0;
77 hEvent = 0;
78 ready_ = 0;
79 }
80
81 private:
82 friend class op_queue_access;
83 friend class win_iocp_io_service;
84 win_iocp_operation* next_;
85 func_type func_;
86 long ready_;
87 };
88
89 } // namespace detail
90 } // namespace asio
91 } // namespace boost
92
93 #include <boost/asio/detail/pop_options.hpp>
94
95 #endif // defined(BOOST_ASIO_HAS_IOCP)
96
97 #endif // BOOST_ASIO_DETAIL_WIN_IOCP_OPERATION_HPP