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 
18 #include <boost/process/config.hpp>
19 
20 #include BOOST_PROCESS_PLATFORM_PROMOTE_PATH(child)
21 BOOST_PROCESS_PLATFORM_PROMOTE_NAMESPACE(child)
22 
23 #if defined(BOOST_PROCESS_DOXYGEN)
24 namespace 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  * Returns the process handle.
51  *
52  * \remark <em>Windows only.</em>
53  */
54  HANDLE process_handle() const
55  {
56  return proc_info.hProcess;
57  }
58 
59  /**
60  * Process identifier.
61  *
62  * \remark <em>POSIX only.</em>
63  */
64  pid_t pid;
65 
66  /**
67  * Constructor.
68  *
69  * \remark <em>POSIX only.</em>
70  */
71  explicit child(pid_t p) : pid(p) {}
72  };
73 }
74 #endif
75 
boost::process
Definition: mitigate.hpp:25
config.hpp
pi
#define pi
Definition: Transition.cpp:37