Boost logo

Boost :

Subject: Re: [boost] Boost.Process 0.5 released
From: Boris Schaeling (boris_at_[hidden])
Date: 2012-08-25 09:08:21


On Sun, 19 Aug 2012 23:06:07 +0200, Oliver Kowalke <oliver.kowalke_at_[hidden]>
wrote:

> [...]process is value-base. What happened if I copy a child class and
> invalidate one of the copies.

The same what happens if you do that with file descriptors and Windows
HANDLEs. And what also happens if you do that with
boost::iostreams::file_descriptor_sink or
boost::iostreams::file_descriptor_source if use
boost::iostreams::close_handle. Not that I'm against RAII - but I wonder
whether we are trying a bit too hard to solve a problem which (seems to me
at least) has never been a problem for anyone in practice. I would be fine
if we could implement the RAII type in a platform-independent way but ...

> I suggest to make the process moveable-only. The default ctor represents
> an 'invalid' process class - testable by child::operator
> <unspecified_bool >() and child::operator!().
> child::discard() could move-away the internal representation so that the
> child instance becomes 'invalid' after this function.

... isn't this a Windows-only solution?

Boris


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