|
Boost : |
Subject: Re: [boost] [gsoc] Boost.Process done
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2010-09-09 07:07:06
Boris Schaeling wrote:
> On Wed, 08 Sep 2010 03:37:52 +0200, Ilya Sokolov
> <ilyasokol_at_[hidden]> wrote:
>
> init_stdout_behavior() would need to make sure that stream
> behaviors are initialized only once (not that there are
> multiple pipes created). But then it's difficult again to
> reuse a context object as it would need to be reset explicitly.
> But this could be done in create_child() again. -
> Comments?
[snip]
> > I expect that if some std stream is closed in the calling process,
> > the default constructor of the context class doesn't throw anything.
> > As I see it, the bp::handle should have a "dont-close" flag and
> > bp::behavior::inherit shouldn't call dup() or DuplicateHandle().
>
> The reason why bp::behavior::inherit calls
> dup()/DuplicateHandle() is that a parent closes a child's
> handles (and a child a parent's handles; this is done in
> create_child()). Otherwise both processes would have a read
> and write end open when a pipe is used. Without a
> dup()/DuplicateHandle() a parent would close its own standard
> streams if it wants the child to inherit them. I think it also
> makes logical sense to automatically close the streams of the
> other process?
>
> As I also think the default constructor of context shouldn't
> throw: What if we add another optional parameter to
> bp::behavior::inherit? A bool variable could be used to
> indicate whether bp::behavior::inherit should throw if
> dup()/DuplicateHandle() fails. By default it throws - but it
> doesn't when used by the default constructor of context?
Perhaps policies could manage the degrees of freedom in behavior? Doing so would give names to the various behaviors you've been discussing and would make more operations implicit once the desired policy is specified.
_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com
IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk