LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   signal handling (SIGSEGV) in threads (https://www.linuxquestions.org/questions/programming-9/signal-handling-sigsegv-in-threads-252802/)

Sinner6 11-09-2004 09:28 AM

signal handling (SIGSEGV) in threads
 
Ok, I think I figured out how to recover from a SIGSEGV. I use a signal handler and use setjmp and longump. But how do I do this in a thread safe manner?
I have a section of code, a simple memory accesser, that will sooner or later cause a SIGSEGV by accessing bad memory, and this code is in a class that will be used by a number of threads ( between 5 and 10). What can I do in a multithread enviroment to recover from this fault?

Mara 11-09-2004 04:52 PM

You can block signals on all threads but one and that one will set a marker checked by the threads after risky operations. Not a perfect solution. In most cases you can just write code that does not cause SIGSEGV, however. :)


All times are GMT -5. The time now is 04:51 PM.