#include <pipe.hpp>
Public Member Functions | |
pipe () | |
file_handle & | rend () |
file_handle & | wend () |
The pipe class is a simple RAII model for anonymous pipes. It provides a portable constructor that allocates a new pipe and creates a pipe object that owns the two file handles associated to it: the read end and the write end.
These handles can be retrieved for modification according to file_handle semantics. Optionally, their ownership can be transferred to external file_handle objects which comes handy when the two ends need to be used in different places (i.e. after a POSIX fork() system call).
Pipes can be copied following the same semantics as file handles. In other words, copying a pipe object invalidates the source one.
boost::process::detail::pipe::pipe | ( | ) | [inline] |
Creates a new pipe.
The default pipe constructor allocates a new anonymous pipe and assigns its ownership to the created pipe object. On Windows when the macro BOOST_PROCESS_WINDOWS_USE_NAMED_PIPE is defined a named pipe is created. This is required if asynchronous I/O should be used as asynchronous I/O is only supported by named pipes on Windows.
boost::system::system_error | If the anonymous pipe creation fails. |
file_handle& boost::process::detail::pipe::rend | ( | ) | [inline] |
Returns the pipe's read end file handle.
Obtains a reference to the pipe's read end file handle. Care should be taken to not duplicate the returned object if ownership shall remain to the pipe.
Duplicating the returned object invalidates its corresponding file handle in the pipe.
file_handle& boost::process::detail::pipe::wend | ( | ) | [inline] |
Returns the pipe's write end file handle.
Obtains a reference to the pipe's write end file handle. Care should be taken to not duplicate the returned object if ownership shall remain to the pipe.
Duplicating the returned object invalidates its corresponding file handle in the pipe.