Home | Libraries | People | FAQ | More |
boost::process::group
// In header: <boost/process/group.hpp> class group { public: // types typedef unspecified group_handle; typedef group_handle::handle_t native_handle_t; // Native representation of the handle. // construct/copy/destruct explicit group(group_handle &&); explicit group(native_handle_t &); group(const group &) = delete; group(group &&); group() = default; group & operator=(const group &) = delete; group & operator=(group &&); ~group(); // public member functions void detach(); void join(); bool joinable(); native_handle_t native_handle() const; void wait(); void wait(std::error_code &) noexcept; template<typename Rep, typename Period> bool wait_for(const std::chrono::duration< Rep, Period > &); template<typename Rep, typename Period> bool wait_for(const std::chrono::duration< Rep, Period > &, std::error_code &) noexcept; template<typename Clock, typename Duration> bool wait_until(const std::chrono::time_point< Clock, Duration > &); template<typename Clock, typename Duration> bool wait_until(const std::chrono::time_point< Clock, Duration > &, std::error_code &) noexcept; bool valid() const; explicit operator bool() const; void terminate(); void terminate(std::error_code &) noexcept; void add(const child &); void add(const child &, std::error_code &) noexcept; bool has(const child &); bool has(const child &, std::error_code &) noexcept; };
Represents a process group.
Groups are movable but non-copyable. The destructor automatically closes handles to the group process.
The group will have the same interface as std::thread.
Note | |
---|---|
If the destructor is called without a previous detach or wait, the group will be terminated. |
Note | |
---|---|
If a default-constructed group is used before being used in a process launch, the behaviour is undefined. Waiting for groups is currently broken on windows and will most likely result in a dead-lock. |
group
public
construct/copy/destructexplicit group(group_handle && ch);
explicit group(native_handle_t & handle);Construct the group from a native_handle.
group(const group &) = delete;
group(group && lhs);Move constructor.
group() = default;Default constructor.
group & operator=(const group &) = delete;
group & operator=(group && lhs);Move assign.
~group();
Destructor
Note | |
---|---|
If the destructor is called without a previous detach or wait, the group will be terminated. |
group
public member functionsvoid detach();Detach the group.
void join();
Join the child. This just calls wait, but that way the naming is similar to std::thread
bool joinable();
Check if the child is joinable.
native_handle_t native_handle() const;Obtain the native handle of the group.
void wait();Wait for the process group to exit.
void wait(std::error_code & ec) noexcept;
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<typename Rep, typename Period> bool wait_for(const std::chrono::duration< Rep, Period > & rel_time);
Wait for the process group to exit for period of time.
Returns: |
True if all child processes exited while waiting. |
template<typename Rep, typename Period> bool wait_for(const std::chrono::duration< Rep, Period > & rel_time, std::error_code & ec) noexcept;
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<typename Clock, typename Duration> bool wait_until(const std::chrono::time_point< Clock, Duration > & timeout_time);
Wait for the process group to exit until a point in time.
Returns: |
True if all child processes exited while waiting. |
template<typename Clock, typename Duration> bool wait_until(const std::chrono::time_point< Clock, Duration > & timeout_time, std::error_code & ec) noexcept;
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
bool valid() const;Check if the group has a valid handle.
explicit operator bool() const;Convenience to call valid.
void terminate();Terminate the process group, i.e. all processes in the group.
void terminate(std::error_code & ec) noexcept;
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void add(const child & c);Assign a child process to the group.
void add(const child & c, std::error_code & ec) noexcept;
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
bool has(const child & c);Check if the child process is in the group.
bool has(const child & c, std::error_code & ec) noexcept;
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.