Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
0002 // Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
0003 // Copyright (c) 2009 Boris Schaeling
0004 // Copyright (c) 2010 Felipe Tanus, Boris Schaeling
0005 // Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009 
0010 #ifndef BOOST_PROCESS_WINDOWS_TERMINATE_HPP
0011 #define BOOST_PROCESS_WINDOWS_TERMINATE_HPP
0012 
0013 #include <boost/process/detail/config.hpp>
0014 #include <system_error>
0015 #include <cstdlib>
0016 #include <boost/winapi/process.hpp>
0017 #include <boost/winapi/get_last_error.hpp>
0018 
0019 namespace boost { namespace process { namespace detail { namespace windows {
0020 
0021 struct child_handle;
0022 
0023 inline void terminate(child_handle &p, std::error_code &ec) noexcept
0024 {
0025     if (!::boost::winapi::TerminateProcess(p.process_handle(), EXIT_FAILURE))
0026         ec = boost::process::detail::get_last_error();
0027     else
0028     {
0029         ec.clear();
0030         ::boost::winapi::CloseHandle(p.proc_info.hProcess);
0031         p.proc_info.hProcess = ::boost::winapi::INVALID_HANDLE_VALUE_;
0032     }
0033 }
0034 
0035 inline void terminate(child_handle &p)
0036 {
0037     std::error_code ec;
0038     terminate(p, ec);
0039     boost::process::detail::throw_error(ec, "TerminateProcess() failed in terminate");
0040 }
0041 
0042 }}}}
0043 
0044 #endif