Signal problem

Marc Lehmann schmorp at
Sat Jan 9 10:30:19 CET 2010

On Fri, Jan 08, 2010 at 10:55:43AM -0800, Tim McClarren <tim at> wrote:
>> So what do you expect? There is no portable way to continue from
>> segfaults, and segfaults are asynchronous.
> Yes.  I was under the impression from the documentation that the purpose  
> of ev_signal was to attempt to deliver asynchronous signals 
> synchronously.

Exactly - so what do you expect?

>> What you try to do makes no sense - segfaults are a serious issue, you
>> can't just pretend nothing has happened and continue (you would have to
>> *fix* the problem and tell your program where to continue afterwards).
> I'm very well aware of that.  I think you're assuming I'm trying to  
> recover gracefully from a SEGV.  That is not what I'm trying to do.
> Might I suggest, as an improvement, if what I'm trying to do makes no  
> sense that ev_signal_init not take SIGSEGV as a parameter and assert?

Might I suggest, as an improvement, getting a book about unix/posix and
reading it?

sigsegv cannot be recovered, so there is no way to make it synchronous to
your event loop. you already know thta, so why bother?

> I am trying to emit a stack to the log.  I've done this before, via the  
> usually sigaction route.

Again, you know you can't continue, so why bother?

Despite you claiming different, I feel that you have a fundamental
misunderstanding about signals, and SIGSEGV in particular. You can't emit
a "stack" (backtrace?) synchronously to your event handling, it has to be
done when you actually have the stack.

libev offers a special service - delivering asynchronous signals
synchronous to your event loop. no amount of assertions can change this,
and no amount of assertions will make up for reading a good book and
understanding how current cpus implement things (i.e. what a sigsegv is,
what a backtrace is, that you only have a backtrace when you are inside a
fucntion etc.).

libev is not a newbie tool, and doesn't attempt to teach you the posix
model, or programming in general. that's up to you, there are a large
number of resoruces outside that do that much better than libev could ever
hope to.

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

More information about the libev mailing list