R
root
Hi
I have a program where there's a main server thread that receives jobs
and then farms them out to worker threads.
Unfortunately there is either a bug or an inconsistency in the jobs data
or something, because quite often the worker thread will try to
dereference NULL. This brings down the whole program.
So what I'd like to do is trap SIGSEGV in the worker threads only (not
the main thread), maybe log the error, but basically have the relevant
thread exit gracefully and not whack the whole process.
Is signal() threadsafe? How can I only catch signals in one thread rather
than for the process as a whole?
Thanks for your help.
I have a program where there's a main server thread that receives jobs
and then farms them out to worker threads.
Unfortunately there is either a bug or an inconsistency in the jobs data
or something, because quite often the worker thread will try to
dereference NULL. This brings down the whole program.
So what I'd like to do is trap SIGSEGV in the worker threads only (not
the main thread), maybe log the error, but basically have the relevant
thread exit gracefully and not whack the whole process.
Is signal() threadsafe? How can I only catch signals in one thread rather
than for the process as a whole?
Thanks for your help.