diff options
Diffstat (limited to 'boost/process/detail/posix/group_handle.hpp')
-rw-r--r-- | boost/process/detail/posix/group_handle.hpp | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/boost/process/detail/posix/group_handle.hpp b/boost/process/detail/posix/group_handle.hpp index 856b36a6b0..8df4d39435 100644 --- a/boost/process/detail/posix/group_handle.hpp +++ b/boost/process/detail/posix/group_handle.hpp @@ -6,14 +6,13 @@ #ifndef BOOST_PROCESS_DETAIL_POSIX_GROUP_HPP_ #define BOOST_PROCESS_DETAIL_POSIX_GROUP_HPP_ +#include <boost/process/detail/config.hpp> #include <boost/process/detail/posix/child_handle.hpp> #include <system_error> #include <unistd.h> namespace boost { namespace process { namespace detail { namespace posix { - - struct group_handle { pid_t grp = -1; @@ -26,7 +25,6 @@ struct group_handle { } - group_handle() = default; ~group_handle() = default; @@ -38,7 +36,6 @@ struct group_handle group_handle &operator=(const group_handle & c) = delete; group_handle &operator=(group_handle && c) { - grp = c.grp; c.grp = -1; return *this; @@ -62,23 +59,14 @@ struct group_handle bool has(handle_t proc, std::error_code & ec) noexcept { return ::getpgid(proc) == grp; - } bool valid() const { return grp != -1; } - }; -inline void terminate(group_handle &p) -{ - if (::killpg(p.grp, SIGKILL) == -1) - boost::process::detail::throw_last_error("killpg(2) failed"); - p.grp = -1; -} - inline void terminate(group_handle &p, std::error_code &ec) noexcept { if (::killpg(p.grp, SIGKILL) == -1) @@ -89,15 +77,18 @@ inline void terminate(group_handle &p, std::error_code &ec) noexcept p.grp = -1; } +inline void terminate(group_handle &p) +{ + std::error_code ec; + terminate(p, ec); + boost::process::detail::throw_error(ec, "killpg(2) failed in terminate"); +} inline bool in_group() { return true; } - - }}}} - #endif /* BOOST_PROCESS_DETAIL_WINDOWS_GROUP_HPP_ */ |