5 // Copyright (c) 2003-2022 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_CONNECT_PIPE_HPP
12 #define BOOST_ASIO_CONNECT_PIPE_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_PIPE) \
21 || defined(GENERATING_DOCUMENTATION)
23 #include <boost/asio/basic_readable_pipe.hpp>
24 #include <boost/asio/basic_writable_pipe.hpp>
25 #include <boost/asio/error.hpp>
27 #include <boost/asio/detail/push_options.hpp>
33 #if defined(BOOST_ASIO_HAS_IOCP)
34 typedef HANDLE native_pipe_handle;
35 #else // defined(BOOST_ASIO_HAS_IOCP)
36 typedef int native_pipe_handle;
37 #endif // defined(BOOST_ASIO_HAS_IOCP)
39 BOOST_ASIO_DECL void create_pipe(native_pipe_handle p[2],
40 boost::system::error_code& ec);
42 BOOST_ASIO_DECL void close_pipe(native_pipe_handle p);
46 /// Connect two pipe ends using an anonymous pipe.
48 * @param read_end The read end of the pipe.
50 * @param write_end The write end of the pipe.
52 * @throws boost::system::system_error Thrown on failure.
54 template <typename Executor1, typename Executor2>
55 void connect_pipe(basic_readable_pipe<Executor1>& read_end,
56 basic_writable_pipe<Executor2>& write_end);
58 /// Connect two pipe ends using an anonymous pipe.
60 * @param read_end The read end of the pipe.
62 * @param write_end The write end of the pipe.
64 * @throws boost::system::system_error Thrown on failure.
66 * @param ec Set to indicate what error occurred, if any.
68 template <typename Executor1, typename Executor2>
69 BOOST_ASIO_SYNC_OP_VOID connect_pipe(basic_readable_pipe<Executor1>& read_end,
70 basic_writable_pipe<Executor2>& write_end, boost::system::error_code& ec);
75 #include <boost/asio/detail/pop_options.hpp>
77 #include <boost/asio/impl/connect_pipe.hpp>
78 #if defined(BOOST_ASIO_HEADER_ONLY)
79 # include <boost/asio/impl/connect_pipe.ipp>
80 #endif // defined(BOOST_ASIO_HEADER_ONLY)
82 #endif // defined(BOOST_ASIO_HAS_PIPE)
83 // || defined(GENERATING_DOCUMENTATION)
85 #endif // BOOST_ASIO_CONNECT_PIPE_HPP