Let's say we have 3 threads A(main), B, C. I am aware that we can send signals to an individual thread using pthread_kill and mask signals in thread using pthread_sigmask. Also, I am aware signal handler is shared between threads in general.
Is it possible to handle Same signal in different ways by installing different handler in each thread? If so how? Say: If segfault received for B it should print something & If it received by C it should ignore & for A it should take some recovery action.
If the thread C executes segfault instruction and no sighandler for SIGSEGV installed in the process, then the core will happen for the entire process or only for that particular thread, So that rest of the threads A, B continue to execute?
As Signal handler is shared, if a signal is sent to the whole process using pid then which thread will execute the handler? based on priority? mask? or no algorithm just random?