|
Boost : |
Subject: Re: [boost] Subject: Formal Review of Proposed Boost.Process library starts tomorrow
From: Artyom (artyomtnk_at_[hidden])
Date: 2011-02-10 14:54:25
> > So basically such thread need
> >
> > forever (
> > sigwait(sigchld)
> > foreach pid in waiting set
> > if(waitpid(pid, WNOHANG) = done)
> > notify io_service
> > remove pid from waiting set
> > }
>
> you iterate over the complete set of pids you are waiting for. why not
> let waitpid( -1,...) let tell which child has changed its status.
>
Because it can accidentally catch an exit code of normal wait
for example consider that other thread waits synchronously,
this was the problem I've told in the original review notes
the race condition between waiting thread and other thread
that makes synchornous wait.
This is why you can't use waitpid with -1 or wait that
catches any child.
> Shouldn't the wait-functionality be interrupt-able?
> How to do a grace full shutdown if forever blocking?
>
It can be done with other signal - you can use real-time
signals to notify the thread on interruption.
Artyom
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk