This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Unix Signals as OS Exceptions in C++


On Sun, Sep 12, 2004 at 10:15:20AM -0400, Ian Lance Taylor wrote:
> It already works fine; just call throw from your signal handler.

This WILL NOT work in general with asynchronous signals, and will
NEVER work in general.

It works for cases like your sleep case here because you're nicely
synchronized on a function call.  Of course, glibc has been adding
nothrow all over the place, so pretty much anything that isn't a
POSIX cancelation point won't work here.

If you *do* want to operate with synchronous signals, SEGV and FPE,
you'll need to compile with -fnon-call-exceptions.  See libjava for
the "interesting" things you have to do with the signal frame in 
order to get the unwind to reliably find the exception data (rather
than merely unwind the stack).

And this only works for ports that have MD_FALLBACK_FRAME_STATE_FOR,
or somehow have unwind info in the signal trampoline.  Which is 
pretty much just Linux and Darwin.


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]