[lug] g++ signals and exceptions question

rm at fabula.de rm at fabula.de
Wed May 15 11:12:09 MDT 2002


On Wed, May 15, 2002 at 10:59:47AM -0600, Jonathan Briggs wrote:
> I should probably ask this question on one of the C++ newsgroups, but I
> haven't had decent newsgroup access for a few months now.  On to the
> question...
> 
> I was thinking that it would be pretty neat if a C++ program could catch
> a signal and raise an exception.  I tried throwing an exception from a
> signal handler, but that only resulted in a messy crash.  I'm sure this
> is because signal handlers use a completely different program stack
> while running.
> 
> Functions such as siglongjmp can manipulate the original program stack
> and go somewhere else.  Does anyone know of a C++ (it can be g++ / Linux
> specific) function or library that would allow raising an exception from
> a signal handler?
> 
> If it doesn't exist, I might try writing it.

Hrm, i somehow recall seeing a c++ signal handing lib/framework (freshmeat?).
Anyway, maybe this helps: http://www.cs.wustl.edu/~schmidt/signal-patterns.html
Beware: i'm in no way a c++ guy ...

  Ralf Mattes

> Do any of you who are experienced C++ programmers see anything wrong
> with this idea?  One problem I thought of is that it might violate
> exception restrictions (functions that declare they will never throw, or
> will only throw exceptions of type int, for example.)
> -- 
> Jonathan Briggs
> jbriggs at esoft.com





More information about the LUG mailing list