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? |
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. |