Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Class group

boost::process::group

Synopsis

// 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;
};

Description

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] Note

If the destructor is called without a previous detach or wait, the group will be terminated.

[Note] Note

If a default-constructed group is used before being used in a process launch, the behaviour is undefined.

[Note] Note

Waiting for groups is currently broken on windows and will most likely result in a dead-lock.

group public construct/copy/destruct

  1. explicit group(group_handle && ch);
  2. explicit group(native_handle_t & handle);
    Construct the group from a native_handle.
  3. group(const group &) = delete;
  4. group(group && lhs);
    Move constructor.
  5. group() = default;
    Default constructor.
  6. group & operator=(const group &) = delete;
  7. group & operator=(group && lhs);
    Move assign.
  8. ~group();

    Destructor

    [Note] Note

    If the destructor is called without a previous detach or wait, the group will be terminated.

group public member functions

  1. void detach();
    Detach the group.
  2. void join();

    Join the child. This just calls wait, but that way the naming is similar to std::thread

  3. bool joinable();

    Check if the child is joinable.

  4. native_handle_t native_handle() const;
    Obtain the native handle of the group.
  5. void wait();
    Wait for the process group to exit.
  6. 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.

  7. 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.

  8. 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.

  9. 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.

  10. 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.

  11. bool valid() const;
    Check if the group has a valid handle.
  12. explicit operator bool() const;
    Convenience to call valid.
  13. void terminate();
    Terminate the process group, i.e. all processes in the group.
  14. 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.

  15. void add(const child & c);
    Assign a child process to the group.
  16. 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.

  17. bool has(const child & c);
    Check if the child process is in the group.
  18. 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.


PrevUpHomeNext