Another race in signal handling

Marc Lehmann schmorp at
Tue Jan 22 12:34:41 CET 2008

On Mon, Jan 21, 2008 at 01:22:13PM -0500, Chris Shoemaker <c.shoemaker at> wrote:
> > Your "fix" of removing gotsig only has the effect of shrinking the time
> > window of this problem occuring, it doesn't fix any underlying issue at
> > all.
> I just tried with the current CVS version.  I ran the program 6 times
> and the longest it ran was 18 seconds.

Since it is unreproducble, the only chance is to track it down on a machine
where it is indeed reproducible.

> What I'm really wondering is: what purpose does the global gotsig
> serve?  I've really tried to understand, but I just can't.  Please
> explain it to me.  Thanks.

The purpose is not writing into the signal pipe when there is already
a byte in there, avoiding both extra syscalls and overflowing the pipe
itself (remember that that was the main reason for netscaoe 4 freezing
all the time. this cannot happen with libev for other reasons, but its a
sensible optimisation).

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

More information about the libev mailing list