|
Boost : |
From: Boris (boriss_at_[hidden])
Date: 2008-08-31 18:30:10
On Sun, 31 Aug 2008 23:20:10 +0200, Ion Gaztañaga <igaztanaga_at_[hidden]>
wrote:
> [...]I understand async I/O should be tied with ASIO. I think
> Boost.Iostreams
To give you an idea how asynchronous I/O with Boost.Process and Boost.Asio
currently looks like:
boost::process::child child; // somehow launched
#if defined(_WIN32)
boost::asio::windows::stream_handle out(io_service,
child.get_stdin().handle().release());
boost::asio::windows::stream_handle in(io_service,
child.get_stdout().handle().release());
#else
boost::asio::posix::stream_descriptor out(io_service,
child.get_stdin().handle().release());
boost::asio::posix::stream_descriptor in(io_service,
child.get_stdout().handle().release());
#endif
in.async_read_some(...);
> [...]I can wait ;-) Since you are working hard on the library, I think
> it's better to wait until you consider the library mature enough. Feel
> free to contact me if you have any question.
OK, I'll tell you once I'm done (as I said I expect until mid September).
The code is nearly done. But with all the changes which I had to merge I
definitely need to update the documentation and samples.
By the way, I would be very interested in a communication channel between
a parent and a child process based on Boost.Interprocess. I need
asynchronous I/O though. Before I picked up Boost.Process I had created a
Boost.Asio extension boost::asio::shared_memory which can be used like
boost::asio::socket. The only (but big :) problem I haven't solved yet is
how to handle more than one communication channel. As read/write
operations in Boost.Interprocess need to be synchronized the calls might
block. A parent process with many children will then have to use at least
one thread per child. What would be required is a demultiplexer which
would work like select() for file descriptors. Then I think asynchronous
I/O could be done with Boost.Interprocess. The question is though what
would that demultiplexer look like? You are not working on supporting
asynchronous I/O in Boost.Interprocess? ;)
Boris
> [...]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk