Bug with signal delivery after fork.

Chris Shoemaker c.shoemaker at cox.net
Tue Jan 15 16:50:34 CET 2008


On Tue, Jan 15, 2008 at 05:06:27AM +0100, Marc Lehmann wrote:
> On Mon, Jan 14, 2008 at 10:56:54AM -0500, Chris Shoemaker <c.shoemaker at cox.net> wrote:
> >     I believe the attached program demonstrates some bug related to signal
> > delivery after a fork.
> 
> Oh, what you see is that ev_default_fork only sets a flag for the next run
> of ev_loop. You will have to run ev_loop to reinitialise the kernel state
> after a fork (e.g. ev_loop (EVLOOP_NONBLOCK) will do).
> 
> The documentation will point this out in the next release (and it will
> contain other things required by kqueue, which makes it less flexible).

Adding:

ev_loop(loop, EVLOOP_NONBLOCK);

immediately after the call to ev_default_fork() did not noticeably
change the behavior of the program.  It still hangs about about 10% of
the time.

-chris



More information about the libev mailing list