Making process survive failure in its thread

view story

http://stackoverflow.com – I'm writing app that has many independant threads. While I'm doing quite low level, dangerous stuff there, threads may fail (SIGSEGV, SIGBUS, SIGFPE) but they should not kill whole process. Is there a way to do it proper way? Currently I intercept aforementioned signals and in their signal handler then I call pthread_exit(NULL). It seems to work but since pthread_exit is not async-signal-safe function I'm a bit concerned about this solution. I know that splitting this app into multiple processes would solve the problem but in this case it's not an feasible option. EDIT: I'm aware of all the (HowTos)