SIGCHLD not received

Marc Lehmann schmorp at schmorp.de
Wed May 30 17:24:19 CEST 2012


On Wed, May 30, 2012 at 06:47:44PM +0400, Denis Bilenko <denis.bilenko at gmail.com> wrote:
> > 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?

The point of ev_loop_fork is to be called.

> 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.

The default loop must be initialised before any child exits, if that is
what the problem was, yes.

> So SIGCHLD was received but it wrote to a pipe end that was soon
> replaced by another pipe in loop_fork().

That can happen, but should be immaterial, as libev compensates for this by
always checking for signals and asyncs after it recreates the pipe.

It's also not what the test program does: in the test program, the _other_
default loop is destroyed on each loop run, and doesn't exist sometimes
when the child exits fast enough (presumably).


-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\



More information about the libev mailing list