
On Thu, 02 Sep 2010 00:21:36 +0200, Ilya Sokolov <ilyasokol@gmail.com> wrote:
On 01.09.2010 23:20, Boris Schaeling wrote:
[snip]
Looking at your proposed stream class I'd call it now a factory class. This makes sense to me and is even easier to explain (as many developers should be familiar with that pattern). The factory method could be called in create_child() making it possible to reuse contexts.
Yep.
But why did you add set_fileno()? Do we need this method if we have create_parent_and_child_end() already? The example looks like as if it's only required by inherit and thus shouldn't be added to stream really?
Probably. There is one more problem that worries me:
ctx.stdin_behavior = bp::behavior::pipe::create(bp::behavior::pipe::input_stream); ^^^^^^^^^^^^ It is too easy to write output_stream here, and in 99% of cases its value is input_stream.
At some point I thought of replacing get_child_end() and get_parent_end() with get_read_end() and get_write_end(). While stdin/stdout/stderr could then pick the right methods for a pipe automatically what would be the read and write end of the stream behaviors inherit or close? That's why I left it as it is. Any other ideas? Boris