Trap errors in a thread


Is there a way to trap all errors including segmentation fault in a thread independently from other threads ?

Something like a try catch(…) in C++



I don’t fully understand your question.

Are you saying from Thread B, you want to trap all errors of Thread A? If that’s what you mean, what exactly do you want to do if you detect such an error? Just log it or somehow allow Thread A to continue (which will be virtually impossible).

Are you wanting to do this in C or C++ and what’s wrong with just using Try-Catch?