diff options
Diffstat (limited to '3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_service.hpp')
-rw-r--r-- | 3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_service.hpp | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_service.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_service.hpp index 86c4391..68a9f90 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_service.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_handle_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -41,7 +41,7 @@ class win_iocp_handle_service { public: // The native type of a stream handle. - typedef HANDLE native_type; + typedef HANDLE native_handle_type; // The implementation type of the stream handle. class implementation_type @@ -61,7 +61,7 @@ public: friend class win_iocp_handle_service; // The native stream handle representation. - native_type handle_; + native_handle_type handle_; // The ID of the thread from which it is safe to cancel asynchronous // operations. 0 means no asynchronous operations have been started yet. @@ -82,12 +82,21 @@ public: // Construct a new handle implementation. BOOST_ASIO_DECL void construct(implementation_type& impl); + // Move-construct a new handle implementation. + BOOST_ASIO_DECL void move_construct(implementation_type& impl, + implementation_type& other_impl); + + // Move-assign from another handle implementation. + BOOST_ASIO_DECL void move_assign(implementation_type& impl, + win_iocp_handle_service& other_service, + implementation_type& other_impl); + // Destroy a handle implementation. BOOST_ASIO_DECL void destroy(implementation_type& impl); // Assign a native handle to a handle implementation. BOOST_ASIO_DECL boost::system::error_code assign(implementation_type& impl, - const native_type& native_handle, boost::system::error_code& ec); + const native_handle_type& handle, boost::system::error_code& ec); // Determine whether the handle is open. bool is_open(const implementation_type& impl) const @@ -100,7 +109,7 @@ public: boost::system::error_code& ec); // Get the native handle representation. - native_type native(const implementation_type& impl) const + native_handle_type native_handle(const implementation_type& impl) const { return impl.handle_; } @@ -136,7 +145,19 @@ public: void async_write_some(implementation_type& impl, const ConstBufferSequence& buffers, Handler handler) { - async_write_some_at(impl, 0, buffers, handler); + // Allocate and construct an operation to wrap the handler. + typedef win_iocp_handle_write_op<ConstBufferSequence, Handler> op; + typename op::ptr p = { boost::addressof(handler), + boost_asio_handler_alloc_helpers::allocate( + sizeof(op), handler), 0 }; + p.p = new (p.v) op(buffers, handler); + + BOOST_ASIO_HANDLER_CREATION((p.p, "handle", &impl, "async_write_some")); + + start_write_op(impl, 0, + buffer_sequence_adapter<boost::asio::const_buffer, + ConstBufferSequence>::first(buffers), p.p); + p.v = p.p = 0; } // Start an asynchronous write at a specified offset. The data being written @@ -152,6 +173,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(buffers, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "handle", &impl, "async_write_some_at")); + start_write_op(impl, offset, buffer_sequence_adapter<boost::asio::const_buffer, ConstBufferSequence>::first(buffers), p.p); @@ -184,7 +207,19 @@ public: void async_read_some(implementation_type& impl, const MutableBufferSequence& buffers, Handler handler) { - async_read_some_at(impl, 0, buffers, handler); + // Allocate and construct an operation to wrap the handler. + typedef win_iocp_handle_read_op<MutableBufferSequence, Handler> op; + typename op::ptr p = { boost::addressof(handler), + boost_asio_handler_alloc_helpers::allocate( + sizeof(op), handler), 0 }; + p.p = new (p.v) op(buffers, handler); + + BOOST_ASIO_HANDLER_CREATION((p.p, "handle", &impl, "async_read_some")); + + start_read_op(impl, 0, + buffer_sequence_adapter<boost::asio::mutable_buffer, + MutableBufferSequence>::first(buffers), p.p); + p.v = p.p = 0; } // Start an asynchronous read at a specified offset. The buffer for the data @@ -201,6 +236,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(buffers, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "handle", &impl, "async_read_some_at")); + start_read_op(impl, offset, buffer_sequence_adapter<boost::asio::mutable_buffer, MutableBufferSequence>::first(buffers), p.p); |