proposal: defer installing SIGCHLD

Marc Lehmann schmorp at
Wed May 23 06:56:54 CEST 2012

On Tue, May 22, 2012 at 01:21:35PM +0400, Denis Bilenko <denis.bilenko at> wrote:
> The patch below defers installing SIGCHLD until the first child
> watcher is started. Thus, if an application does not use child
> watchers, libev never installs a SIGCHLD handler.

That breaks existing applications, so, no.

> I know that I can override libev's SIGCHLD handler with my own, but
> it's less than ideal because it requires the user to explicitly
> specify whether he wants to do that in advance. I'm much happier with
> the patch below, since the old code (using waitpid()) and the new code
> (using child watchers) "just works", no configuration required.

I don't quite understand that - instead of a deterministic "either this
package or that package handles sigchld" you want some "it kind of works
until somebody does somethign we don't know and then everything breaks" :)

With the current behaviour you can indeed choose to either support libev or a
third-party way to handle this, and both can be used, but not mixed - the
last library initialised wins.

With your change, it would become a lot harder to control libev and/or
third party libraries, because you would have to take over only after
libev has installed a watcher.

Note that you can already implement the behaviour you want (even though it
doesn't seem reasonable to me) with current libev, because, as you said,
you can manage sigchld on your own, so you just need a wrapper around

> Of course, using both the old way and the new way in the same app
> still won't work, but that's a reasonable limitation.

Depends on the the other library - libev supports having sigchld managed
for it by another package.

                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_    
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at
      -=====/_/_//_/\_,_/ /_/\_\

More information about the libev mailing list