Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:50:08

0001 // Copyright (c) 2016 Klemens D. Morgenstern
0002 //
0003 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0004 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 #ifndef BOOST_PROCESS_DETAIL_WINDOWS_GROUP_REF_HPP_
0007 #define BOOST_PROCESS_DETAIL_WINDOWS_GROUP_REF_HPP_
0008 
0009 #include <boost/winapi/process.hpp>
0010 #include <boost/process/detail/config.hpp>
0011 #include <boost/process/detail/windows/group_handle.hpp>
0012 #include <boost/process/detail/used_handles.hpp>
0013 #include <boost/process/detail/windows/handler.hpp>
0014 
0015 namespace boost { namespace process {
0016 
0017 namespace detail { namespace windows {
0018 
0019 
0020 
0021 struct group_ref : handler_base_ext, ::boost::process::detail::uses_handles
0022 {
0023     ::boost::winapi::HANDLE_ handle;
0024 
0025     ::boost::winapi::HANDLE_ get_used_handles() const { return handle; }
0026 
0027     explicit group_ref(group_handle &g) :
0028                 handle(g.handle())
0029     {}
0030 
0031     template <class Executor>
0032     void on_setup(Executor& exec) const
0033     {
0034         //I can only enable this if the current process supports breakaways.
0035         if (in_group() && break_away_enabled(nullptr))
0036             exec.creation_flags  |= boost::winapi::CREATE_BREAKAWAY_FROM_JOB_;
0037     }
0038 
0039 
0040     template <class Executor>
0041     void on_success(Executor& exec) const
0042     {
0043         if (!::boost::winapi::AssignProcessToJobObject(handle, exec.proc_info.hProcess))
0044             exec.set_error(::boost::process::detail::get_last_error(),
0045                            "AssignProcessToJobObject() failed.");
0046 
0047     }
0048 
0049 };
0050 
0051 }}}}
0052 
0053 
0054 #endif /* BOOST_PROCESS_DETAIL_WINDOWS_GROUP_HPP_ */