Mail Archives: djgpp/1998/04/08/03:09:07
On Tue, 7 Apr 1998, John Kismul wrote:
> signal(SIGSEGV,hello);
>
> void hello(void)
> {
> return;
> }
> ***
>
> But that don't work.
It *does* work (try "raise(SIGSEGV)" and you will see it yourself).
However, when SIGSEGV is generated by a *real* exception, the DJGPP
signal-generating machinery disallows such code and aborts your
program when it sees that the signal handler tries to return. The
reason is that if you were allowed to return, the same exception would
be generated again and again, ad nauseum, because you return to the
same instruction that triggered the exception, and whatever condition
that caused the exception still exists.
The only way to prevent your program from aborting is to have your
signal handler longjmp into another place in your program.
- Raw text -