1 | // |
---|---|
2 | // connect_pipe.hpp |
3 | // ~~~~~~~~~~~~~~~~ |
4 | // |
5 | // Copyright (c) 2003-2024 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_CONNECT_PIPE_HPP |
12 | #define BOOST_ASIO_CONNECT_PIPE_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_PIPE) \ |
21 | || defined(GENERATING_DOCUMENTATION) |
22 | |
23 | #include <boost/asio/basic_readable_pipe.hpp> |
24 | #include <boost/asio/basic_writable_pipe.hpp> |
25 | #include <boost/asio/error.hpp> |
26 | |
27 | #include <boost/asio/detail/push_options.hpp> |
28 | |
29 | namespace boost { |
30 | namespace asio { |
31 | namespace detail { |
32 | |
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) |
38 | |
39 | BOOST_ASIO_DECL void create_pipe(native_pipe_handle p[2], |
40 | boost::system::error_code& ec); |
41 | |
42 | BOOST_ASIO_DECL void close_pipe(native_pipe_handle p); |
43 | |
44 | } // namespace detail |
45 | |
46 | /// Connect two pipe ends using an anonymous pipe. |
47 | /** |
48 | * @param read_end The read end of the pipe. |
49 | * |
50 | * @param write_end The write end of the pipe. |
51 | * |
52 | * @throws boost::system::system_error Thrown on failure. |
53 | */ |
54 | template <typename Executor1, typename Executor2> |
55 | void connect_pipe(basic_readable_pipe<Executor1>& read_end, |
56 | basic_writable_pipe<Executor2>& write_end); |
57 | |
58 | /// Connect two pipe ends using an anonymous pipe. |
59 | /** |
60 | * @param read_end The read end of the pipe. |
61 | * |
62 | * @param write_end The write end of the pipe. |
63 | * |
64 | * @throws boost::system::system_error Thrown on failure. |
65 | * |
66 | * @param ec Set to indicate what error occurred, if any. |
67 | */ |
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); |
71 | |
72 | } // namespace asio |
73 | } // namespace boost |
74 | |
75 | #include <boost/asio/detail/pop_options.hpp> |
76 | |
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) |
81 | |
82 | #endif // defined(BOOST_ASIO_HAS_PIPE) |
83 | // || defined(GENERATING_DOCUMENTATION) |
84 | |
85 | #endif // BOOST_ASIO_CONNECT_PIPE_HPP |
86 |