SIGCHLD not received

Marc Lehmann schmorp at
Tue May 29 17:39:30 CEST 2012

On Tue, May 29, 2012 at 05:29:20PM +0200, Gabriel Kerneis <kerneis at> wrote:
> I do not understand what you mean here, probably because I never tried to mix
> fork, pthreads and epoll in a single program.  Could you please provide some
> more details,

epoll: epoll file descriptors are available in the child, and events are
delivered to both, even for file descriptors that are closed in one of the
processes. since you need an fd to remove fds from an epoll set, you can't
remove that fd (libev uses a heuristic to detetc this case and then recreates
the whole epoll ste, which cna be slow)

kqueue: the kqueue fd is close'd during fork (yes, missing :), or disabled
(yes, fd is still there) and event libraries cannot reallx distinguish
between the cases. this is not as bad as epoll, but still requires special
fork support from event libraries.

pthreads: after pthread_create, the child environment after fork is
as restricted as in a signal handler, i.e. after fork, you cannot use
malloc/printf or anything else thats unsafe in a signal handler.

the result of this is that it's no fun at all to use fork for

(not that fork ever was so good for multiprocessing when doing something
more complicated than a preforked server).

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

More information about the libev mailing list