libev signal mask and thread

Marc Lehmann schmorp at
Sun Apr 29 02:04:29 CEST 2012

On Sat, Apr 28, 2012 at 10:56:27PM +0400, Konstantin Osipov <kostja at> wrote:
> > If this is the case, then this is another issue, independent of
> > libev. Libev does not care which thread handles the signal, it only
> > cares about not receiving a signal while it manipulates it's signal data
> > structures.
> I don't think it's going to be the case if signalfd is used.

signalfd is an orthogonal issue. with signalfd, you have to block the
signal in all threads (and libev can't do that for you).

> But generally, if I remember my Butenhof (*) correctly, that's what
> can happen according to SUSv2/POSIX.

It may happen, depending on the code. It should not be possible with libev,
regardless of the signal mode.

All that you need to take care of is to set EVFLAG_NOSIGMASK if you start
a thread in your program, and make sure one or more threads handle the

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

More information about the libev mailing list