Boost logo

Boost :

Subject: Re: [boost] [Interprocess] Named pipe interface proposal
From: Boris Schaeling (boris_at_[hidden])
Date: 2013-08-11 08:11:58


On Sat, 10 Aug 2013 03:45:38 +0200, Geoff Shannon
<geoffpshannon_at_[hidden]> wrote:

Hi Geoff,

> [...]As a point of interest this interface is meant to be extremely
> simple. I
> don't intend to initially support ANYTHING except for basic creation and
> reading and writing.

I'm interested in named pipe support as Boost.Process could benefit a lot
(not an official Boost library but everyone calls it like that).

We have a function called create_pipe() which creates an anonymous pipe
(see
<http://www.highscore.de/boost/process0.5/boost/process/create_pipe_id341354.html>).
The function returns an object which is similar to a pair of file
descriptors/Windows handles (see
<http://www.highscore.de/boost/process0.5/boost/process/pipe.html>). The
library refers to these things as pipe ends. The pipe ends can be used to
create a boost::iostreams::file_descriptor_source or
boost::iostreams::file_descriptor_sink object to do synchronous I/O (see
<http://www.highscore.de/boost/process0.5/boost_process/tutorial.html#boost_process.tutorial.synchronous_i_o>).

For asynchronous I/O Windows requires a named pipe. Boost.Process doesn't
provide anything out of the box to help users though. There is a
create_async_pipe() function used in the documentation. But it's left as
an exercise to the reader to implement it. :/ I actually implemented it in
the unit tests. But there is too much hardcoded that it's of any use to
others.

This function create_async_pipe() returns the same pair of file
descriptors/Windows handles as create_pipe() does. Instead of putting
these pipe ends into Boost.Iostreams objects they are now used to
instantiate boost::asio::windows::stream_handle or
boost::asio::posix::stream_descriptor (see
<http://www.highscore.de/boost/process0.5/boost_process/tutorial.html#boost_process.tutorial.asynchronous_i_o>).
These classes from Boost.Asio can be used as is for asynchronous I/O with
named pipes.

All of that is really a low-level view as you actually deal with file
descriptors/Windows handles. I don't know whether you want to go that way
(your interface makes me think you are higher level). If you can provide a
Boost.Asio I/O object for named pipes, or if you can provide access to the
pipe ends of your named pipe it would however help to make asynchronous
I/O with Boost.Process easier to use.

Boris


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk