child.hpp
Go to the documentation of this file.
1// Copyright (c) 2006, 2007 Julio M. Merino Vidal
2// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
3// Copyright (c) 2009 Boris Schaeling
4// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
5// Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
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 * \file boost/process/child.hpp
12 *
13 * Defines a child process class.
14 */
15
16#pragma once
17
19
20#include BOOST_PROCESS_PLATFORM_PROMOTE_PATH(child)
21BOOST_PROCESS_PLATFORM_PROMOTE_NAMESPACE(child)
22
23#if defined(BOOST_PROCESS_DOXYGEN)
24namespace boost::process
25{
26
27 /**
28 * Represents a child process.
29 *
30 * On Windows child is movable but non-copyable. The destructor
31 * automatically closes handles to the child process.
32 */
33 struct child
34 {
35 /**
36 * Process information.
37 *
38 * \remark <em>Windows only.</em>
39 */
40 PROCESS_INFORMATION proc_info;
41
42 /**
43 * Constructor.
44 *
45 * \remark <em>Windows only.<em/>
46 */
47 explicit child(const PROCESS_INFORMATION& pi) : proc_info(pi)
48 {
49 }
50
51 /**
52 * Returns the process handle.
53 *
54 * \remark <em>Windows only.</em>
55 */
56 HANDLE
57 process_handle() const
58 {
59 return proc_info.hProcess;
60 }
61
62 /**
63 * Process identifier.
64 *
65 * \remark <em>POSIX only.</em>
66 */
67 pid_t pid;
68
69 /**
70 * Constructor.
71 *
72 * \remark <em>POSIX only.</em>
73 */
74 explicit child(pid_t p) : pid(p)
75 {
76 }
77 };
78} // namespace boost::process
79#endif
#define pi
Defines various macros.