Linux exception handling

I am porting a Windows program to Linux. My program uses structured Windows exception handling (SEH). Linux does not support structured exception handling, but does provide signal processing. We can redefine the signal for developing SEH as a paradigm.

Once you can filter the exception, Windows provides three alternative execution control flows:

1) EXCEPTION_EXECUTE_HANDLER: execute the handler 2) EXCEPTION_CONTINUE_SEARCH: forward the exception to the next block (if it does not exist then in the OS) 3) EXCEPTION_CONTINUE_EXECUTION: Continue the exception from the instruction in which the interrupt occurred.

How can I achieve these control flows in Linux . On Linux, after processing the signal, the program starts execution from where it was interrupted. How to develop continue_search and execute_handler paradigms?

Thanks in advance

+5
source share
1 answer

There is no easy way to do what you want here in C ++. Your tools are the standard exception mechanism in C ++ and sigaction. A handler sigactioncan return control to where it left off. He may quit, although there is debate about the safety of this. Some will say that he should set the atomic variable and return. (The problem is that the compiler does not see the possibility of a throw and therefore is not ready for it.)

C, , sigsetjmp, , .

, , .

+5

All Articles