Reputation: 121
My project language is C and will just run one process and multiple threads.
One of thread always crash, it will case process crash.
The stability of the process is very very important. So I want to know whether it is possible to "isolation" this thread. For example, if we can intercept SIGSEGV signal, we can just restart this thread.
Upvotes: 0
Views: 433
Reputation: 11
Depends on the cause of the crash. It could be memory related resulting in corrupt data thus leading to the process crash. If the program does crash and it is critical, use Monit to restart it.
Upvotes: 0
Reputation: 718768
The stability of the process is very very important.
Then it is very very important that you find and fix the cause of the SIGSEGV rather than "papering over the cracks" by trying to recover crashed threads.
Why?
Upvotes: 1
Reputation: 223739
If one thread does something that could cause a crash it might be affecting another thread since they share the same memory space, so there's no way to isolate them.
You need to fix your program so it doesn't crash in the first place. Start by using a memory checker such as valgrind.
Upvotes: 1