]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/process/detail/windows/group_ref.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / process / detail / windows / group_ref.hpp
1 // Copyright (c) 2016 Klemens D. Morgenstern
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6 #ifndef BOOST_PROCESS_DETAIL_WINDOWS_GROUP_REF_HPP_
7 #define BOOST_PROCESS_DETAIL_WINDOWS_GROUP_REF_HPP_
8
9 #include <boost/process/detail/config.hpp>
10 #include <boost/process/detail/windows/group_handle.hpp>
11 #include <boost/winapi/process.hpp>
12 #include <boost/process/detail/windows/handler.hpp>
13
14 namespace boost { namespace process {
15
16 namespace detail { namespace windows {
17
18
19
20 struct group_ref : handler_base_ext
21 {
22 ::boost::winapi::HANDLE_ handle;
23
24 explicit group_ref(group_handle &g) :
25 handle(g.handle())
26 {}
27
28 template <class Executor>
29 void on_setup(Executor& exec) const
30 {
31 //I can only enable this if the current process supports breakaways.
32 if (in_group() && break_away_enabled(nullptr))
33 exec.creation_flags |= boost::winapi::CREATE_BREAKAWAY_FROM_JOB_;
34 }
35
36
37 template <class Executor>
38 void on_success(Executor& exec) const
39 {
40 if (!::boost::winapi::AssignProcessToJobObject(handle, exec.proc_info.hProcess))
41 exec.set_error(::boost::process::detail::get_last_error(),
42 "AssignProcessToJobObject() failed.");
43
44 }
45
46 };
47
48 }}}}
49
50
51 #endif /* BOOST_PROCESS_DETAIL_WINDOWS_GROUP_HPP_ */