
On Mon, 01 Sep 2008 17:52:52 +0200, Ion GaztaƱaga <igaztanaga@gmail.com> wrote:
Boris wrote:
On Sun, 31 Aug 2008 23:20:10 +0200, Ion GaztaƱaga <igaztanaga@gmail.com> 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 don't know ASIO but it's a shame that it does not offer a portable interface for async I/O.
It's not really Boost.Asio's fault here. The library is very portable but provides two platform-specific I/O objects which I use here. For better portability it would be Boost.Process' job to provide one I/O object instead of forcing developers to pass the underlying file descriptor or HANDLE to Boost.Asio's platform-specific I/O objects. :)
[...]I don't have much idea about async I/O but we can try to write something once we know what we need. I might be completly wrong but boost::interprocess::shared_memory_object is based on a file descriptor (shm_open in unix and a plan file on windows) so we can just obtain the handle and see if select() and WaitForMultipleObject() work on them. After all, write() should work on UNIX with a shared memory object descritor.
Hm, sounds like a good idea. Is there any method I could call to access the file descriptor and handle? Then I could try and use the same Boost.Asio I/O objects as above to check if the idea basically works. Boris