SIGCHLD not received
Denis Bilenko
denis.bilenko at gmail.com
Wed May 30 16:47:44 CEST 2012
On Wed, May 30, 2012 at 5:33 PM, Marc Lehmann <schmorp at schmorp.de> wrote:
> On Wed, May 30, 2012 at 02:55:52PM +0400, Denis Bilenko <denis.bilenko at gmail.com> wrote:
>> Yes, it seems that waitpid() somehow masks or avoids the bug. If I
>> apply this small patch to your program it fails - why?
>
> The test program still forks with an existing loop,
Which is legal, otherwise what's the point of ev_loop_fork and fork
watchers if not fork an existing event loop?
I think figured why it fails though - the child forked off in
subprocess() is short-lived and can die before loop_fork() was
actually executed by ev_run(). Merely calling ev_loop_fork() is not
enough, but if it's followed by ev_run() (which exits immediately
because there are no watchers) then it works.
So SIGCHLD was received but it wrote to a pipe end that was soon
replaced by another pipe in loop_fork().
More information about the libev
mailing list