File indexing completed on 2025-01-18 09:28:55
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_ASIO_IMPL_CONNECT_PIPE_HPP
0012 #define BOOST_ASIO_IMPL_CONNECT_PIPE_HPP
0013
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif
0017
0018 #include <boost/asio/detail/config.hpp>
0019
0020 #if defined(BOOST_ASIO_HAS_PIPE)
0021
0022 #include <boost/asio/connect_pipe.hpp>
0023 #include <boost/asio/detail/throw_error.hpp>
0024
0025 #include <boost/asio/detail/push_options.hpp>
0026
0027 namespace boost {
0028 namespace asio {
0029
0030 template <typename Executor1, typename Executor2>
0031 void connect_pipe(basic_readable_pipe<Executor1>& read_end,
0032 basic_writable_pipe<Executor2>& write_end)
0033 {
0034 boost::system::error_code ec;
0035 boost::asio::connect_pipe(read_end, write_end, ec);
0036 boost::asio::detail::throw_error(ec, "connect_pipe");
0037 }
0038
0039 template <typename Executor1, typename Executor2>
0040 BOOST_ASIO_SYNC_OP_VOID connect_pipe(basic_readable_pipe<Executor1>& read_end,
0041 basic_writable_pipe<Executor2>& write_end, boost::system::error_code& ec)
0042 {
0043 detail::native_pipe_handle p[2];
0044 detail::create_pipe(p, ec);
0045 if (ec)
0046 BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
0047
0048 read_end.assign(p[0], ec);
0049 if (ec)
0050 {
0051 detail::close_pipe(p[0]);
0052 detail::close_pipe(p[1]);
0053 BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
0054 }
0055
0056 write_end.assign(p[1], ec);
0057 if (ec)
0058 {
0059 boost::system::error_code temp_ec;
0060 read_end.close(temp_ec);
0061 detail::close_pipe(p[1]);
0062 BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
0063 }
0064
0065 BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
0066 }
0067
0068 }
0069 }
0070
0071 #include <boost/asio/detail/pop_options.hpp>
0072
0073 #endif
0074
0075 #endif