Changeset 44676


Ignore:
Timestamp:
Apr 21, 2008, 5:32:34 AM (10 years ago)
Author:
chris_kohlhoff
Message:

Add new wrapper classes for stream-oriented handles on Windows.

Location:
trunk
Files:
11 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/boost/asio.hpp

    r44675 r44676  
    7878#include <boost/asio/time_traits.hpp>
    7979#include <boost/asio/version.hpp>
     80#include <boost/asio/windows/basic_handle.hpp>
     81#include <boost/asio/windows/basic_stream_handle.hpp>
     82#include <boost/asio/windows/stream_handle.hpp>
     83#include <boost/asio/windows/stream_handle_service.hpp>
    8084#include <boost/asio/write.hpp>
    8185
  • trunk/boost/asio/detail/win_iocp_io_service.hpp

    r44663 r44676  
    151151
    152152  // Register a handle with the IO completion port.
    153   void register_handle(HANDLE handle)
    154   {
    155     ::CreateIoCompletionPort(handle, iocp_.handle, 0, 0);
     153  boost::system::error_code register_handle(
     154      HANDLE handle, boost::system::error_code& ec)
     155  {
     156    if (::CreateIoCompletionPort(handle, iocp_.handle, 0, 0) == 0)
     157    {
     158      DWORD last_error = ::GetLastError();
     159      ec = boost::system::error_code(last_error,
     160          boost::asio::error::get_system_category());
     161    }
     162    else
     163    {
     164      ec = boost::system::error_code();
     165    }
     166    return ec;
    156167  }
    157168
  • trunk/boost/asio/detail/win_iocp_socket_service.hpp

    r44673 r44676  
    254254
    255255    HANDLE sock_as_handle = reinterpret_cast<HANDLE>(sock.get());
    256     iocp_service_.register_handle(sock_as_handle);
     256    if (iocp_service_.register_handle(sock_as_handle, ec))
     257      return ec;
    257258
    258259    impl.socket_ = sock.release();
     
    275276    }
    276277
    277     iocp_service_.register_handle(native_socket.as_handle());
     278    if (iocp_service_.register_handle(native_socket.as_handle(), ec))
     279      return ec;
    278280
    279281    impl.socket_ = native_socket;
  • trunk/libs/asio/test/Jamfile

    r44675 r44676  
    8787  [ run stream_socket_service.cpp <template>asio_unit_test ]
    8888  [ run time_traits.cpp <template>asio_unit_test ]
     89  [ run windows/basic_handle.cpp <template>asio_unit_test ]
     90  [ run windows/basic_stream_handle.cpp <template>asio_unit_test ]
     91  [ run windows/stream_handle.cpp <template>asio_unit_test ]
     92  [ run windows/stream_handle_service.cpp <template>asio_unit_test ]
    8993  [ run write.cpp <template>asio_unit_test ]
    9094  ;
  • trunk/libs/asio/test/Jamfile.v2

    r44675 r44676  
    151151  [ link time_traits.cpp ]
    152152  [ link time_traits.cpp : $(USE_SELECT) : time_traits_select ]
     153  [ link windows/basic_handle.cpp : : windows_basic_handle ]
     154  [ link windows/basic_handle.cpp : $(USE_SELECT) : windows_basic_handle_select ]
     155  [ link windows/basic_stream_handle.cpp : : windows_basic_stream_handle ]
     156  [ link windows/basic_stream_handle.cpp : $(USE_SELECT) : windows_basic_stream_handle_select ]
     157  [ link windows/stream_handle.cpp : : windows_stream_handle ]
     158  [ link windows/stream_handle.cpp : $(USE_SELECT) : windows_stream_handle_select ]
     159  [ link windows/stream_handle_service.cpp : : windows_stream_handle_service ]
     160  [ link windows/stream_handle_service.cpp : $(USE_SELECT) : windows_stream_handle_service_select ]
    153161  [ run write.cpp ]
    154162  [ run write.cpp : : : $(USE_SELECT) : write_select ]
Note: See TracChangeset for help on using the changeset viewer.