Subject: Re: [boost] Process library with child process events
From: Jeremy Maitin-Shepard (jeremy_at_[hidden])
Date: 2011-06-03 00:11:44
On 06/02/2011 04:31 PM, Klaim - JoÃ«l Lamotte wrote:
> On Thu, Jun 2, 2011 at 14:57, Jeff Flinn<Jeffrey.Flinn_at_[hidden]> wrote:
>> This area needs more work, there is just enough there to support our
>> current needs. The boost::process::monitor::join method is used to wait for
>> a child process to 'finish' due to whatever cause, which returns the exit
>> code on windows and the status on posix.
>> There is a template method boost::process::monitor::join<class EXCEPTION>
>> that throws a default constructed exception of the supplied type when join
>> returns a non-zero value.
> Yes, I've seen the join functions but that's clearly not enough. What if the
> parent process does have things to do too while the child process works?
> It looks like using join would then require a listener thread for each child
> process that I want to get notified the end of.
> Is it a reasonable way of handling it? It looks like a bit overkill to have
> a thread+process pair for each child process...
> But maybe there is no other way, I'm not sure because I don't know a lot
> about the problem domain.
This issue is solvable, but it is not easy because it can only be solved
by first writing a library to handle certain global state such as
SIGCHLD, and this is additionally complicated by the fact that the
necessary abstractions are not platform independent. Also, on Windows
at least one separate thread might be needed in some cases.
Nonetheless, I think solving it is of critical importance for a Boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk