Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class postream

boost::process::postream

Synopsis

// In header: <boost/process/postream.hpp>


class postream {
public:
  // construct/copy/destruct
  postream(boost::process::handle);

  // public member functions
  const boost::process::handle & handle() const;
  boost::process::handle & handle() ;
  void close() ;
};

Description

Child process' input stream.

The postream class represents an input communication channel with the child process. The child process reads data from this stream and the parent process can write to it through the postream object. In other words, from the child's point of view, the communication channel is an input one, but from the parent's point of view it is an output one; hence the confusing postream name.

postream objects cannot be copied because they buffer data that flows through the communication channel.

A postream object behaves as a std::ostream stream in all senses. The class is only provided because it must provide a method to let the caller explicitly close the communication channel.

Blocking remarks: Functions that write data to this stream can block if the associated handle blocks during the write. As this class is used to communicate with child processes through anonymous pipes, the most typical blocking condition happens when the child is not processing the data in the pipe's system buffer. When this happens, the buffer eventually fills up and the system blocks until the reader consumes some data, leaving some new room.

postream public construct/copy/destruct

  1. postream(boost::process::handle h);

    Creates a new process' input stream.

postream public member functions

  1. const boost::process::handle & handle() const;

    Returns the handle managed by this stream.

  2. boost::process::handle & handle() ;

    Returns the handle managed by this stream.

  3. void close() ;

    Closes the handle managed by this stream.

    Explicitly closes the handle managed by this stream. This function can be used by the user to tell the child process there is no more data to send.


PrevUpHomeNext