<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi all !
<br>I got a problem when i throw an exception in a signalhandler. When
i force a SIGFPE signal the exception in the signalhandler causes an SIGABRT.
When i call the Signalhandler manuell everything works fine. The little
testprogramm shows my problem. I hope someone cauld give me a little hint.
Thx
<p>#ifdef HAVE_CONFIG_H
<br>#include <config.h>
<br>#endif
<p>#include <iostream.h>
<br>#include <stdlib.h>
<br>#include <signal.h>
<br>
<p>void ErrorFunc(int Error);
<br>void SignalHandler(int signo);
<p>main()
<br>{
<br>
<br> signal( SIGFPE, &SignalHandler
);
<br> ErrorFunc(0);
<br> ErrorFunc(1);
<br>}
<p>void ErrorFunc(int Error)
<br>{
<br> try
<br> {
<br> cout << "Error code
is " << Error << endl;
<p> // force a SIGFPE Signal --> excepition
fails
<br> int i = 10/0;
<p> // manual call of SignalHandler
--> excepition works fine
<br> //SignalHandler(1);
<p> if (Error > 0 )
<br> {
<br>
throw(Error); // This statement
causes control to jump
<br>
// to the 'catch' statement
<br> }
<p> cout << "No Error occoured"
<< endl;
<p> }
<br> catch(int n)
<br> {
<br> cout << "Error number
is " << n << endl;;
<br> }
<br>}
<p>void SignalHandler(int signo)
<br>{
<br> cout << "In SignalHandler
before throw" << endl;
<br> throw(99);
<br> cout << "In SignalHandler
after throw" << endl;
<br> exit(1);
<br>}
<br>
<br>
<br>
<pre>--
Thimo Nuehs
Softwareentwicklung
RATIO Entwicklungen GmbH
Admiralitätstr. 59
20459 Hamburg
Phone..: +49-(0)40-369007-40
Fax....: +49-(0)40-369007-75
Email..: <A HREF="mailto:tnu@ratio.de">mailto:tnu@ratio.de</A></pre>
</html>