Boost logo

Boost :

From: Angus Leeming (angus.leeming_at_[hidden])
Date: 2004-06-23 05:38:38

John Maddock wrote:
> Surely there's no need to call wait until the parent asks for the return
> value: In fact I'd kind of like the library to be similar to
> Boost.Threads - a child process is an object that can be waited upon,
> the library would only need to do something "fancy" like installing a
> signal hander, if the child object's destructor is called, without the
> object ever being waited upon.

Consider this:

int main() {
        child::process mozilla;
        return 0;

You're suggestion, that child::process::~process() invokes wait() means
that this program will not exit until mozilla exits. That doesn't seem
reasonable here. Even less so if the function launching mozilla was in a
control loop...

child::process is a *handle* on the child. If the handle goes out of
scope, then you lose the abiity to communicate with the child but you
shouldn't kill it.

I think that if you want to terminate the child, then you should be
explicit about it. Either invoke process::terminate yourself or have a
wrapper class that does so when the wrapper goes out of scope.


Boost list run by bdawes at, gregod at, cpdaniel at, john at