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 #pragma once
11 
12 #include <boost/move/move.hpp>
13 #include <Windows.h>
14 
16 {
17 
18  class child
19  {
20  public:
21  PROCESS_INFORMATION proc_info;
22 
23  explicit child(const PROCESS_INFORMATION& pi) : proc_info(pi) {}
24 
26  {
27  ::CloseHandle(proc_info.hProcess);
28  ::CloseHandle(proc_info.hThread);
29  }
30 
31  child(BOOST_RV_REF(child) c) : proc_info(c.proc_info)
32  {
33  c.proc_info.hProcess = INVALID_HANDLE_VALUE;
34  c.proc_info.hThread = INVALID_HANDLE_VALUE;
35  }
36 
37  child& operator=(BOOST_RV_REF(child) c)
38  {
39  ::CloseHandle(proc_info.hProcess);
40  ::CloseHandle(proc_info.hThread);
41  proc_info = c.proc_info;
42  c.proc_info.hProcess = INVALID_HANDLE_VALUE;
43  c.proc_info.hThread = INVALID_HANDLE_VALUE;
44  return *this;
45  }
46 
47  HANDLE process_handle() const
48  {
49  return proc_info.hProcess;
50  }
51 
52  private:
53  BOOST_MOVABLE_BUT_NOT_COPYABLE(child);
54  };
55 
56 }
boost::process::windows::child::proc_info
PROCESS_INFORMATION proc_info
Definition: child.hpp:21
boost::process::windows::child::operator=
child & operator=(BOOST_RV_REF(child) c)
Definition: child.hpp:37
boost::process::windows::child::child
child(const PROCESS_INFORMATION &pi)
Definition: child.hpp:23
boost::process::windows
Definition: child.hpp:15
boost::process::windows::child::~child
~child()
Definition: child.hpp:25
boost::process::windows::child::child
child(BOOST_RV_REF(child) c)
Definition: child.hpp:31
boost::process::windows::child
Definition: child.hpp:18
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
pi
#define pi
Definition: Transition.cpp:37
boost::process::windows::child::process_handle
HANDLE process_handle() const
Definition: child.hpp:47