excepitons and signals
Thimo Nuehs
tnu at ratio.de
Wed Mar 22 11:55:21 GMT 2000
Hi all !
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
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <iostream.h>
#include <stdlib.h>
#include <signal.h>
void ErrorFunc(int Error);
void SignalHandler(int signo);
main()
{
signal( SIGFPE, &SignalHandler );
ErrorFunc(0);
ErrorFunc(1);
}
void ErrorFunc(int Error)
{
try
{
cout << "Error code is " << Error << endl;
// force a SIGFPE Signal --> excepition fails
int i = 10/0;
// manual call of SignalHandler --> excepition works fine
//SignalHandler(1);
if (Error > 0 )
{
throw(Error); // This statement causes control to
jump
// to the 'catch' statement
}
cout << "No Error occoured" << endl;
}
catch(int n)
{
cout << "Error number is " << n << endl;;
}
}
void SignalHandler(int signo)
{
cout << "In SignalHandler before throw" << endl;
throw(99);
cout << "In SignalHandler after throw" << endl;
exit(1);
}
--
Thimo Nuehs
Softwareentwicklung
RATIO Entwicklungen GmbH
Admiralitätstr. 59
20459 Hamburg
Phone..: +49-(0)40-369007-40
Fax....: +49-(0)40-369007-75
Email..: mailto:tnu at ratio.de
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop/attachments/20000322/37473983/attachment.html>
More information about the KDevelop
mailing list