These two explanations really do not contradict each other, given the fact that Linux hackers tend to get confused about the difference between a thread and a process, mainly due to a historical error when trying to pretend that threads can be implemented as processes that share memory .:-)
Based on the foregoing, explanation No. 2 is much more detailed, complete and correct.
Regarding the contents of the stack and the register, each thread can register its own alternative signal processing stack, and the process can select from a signal based on each signal that will be transmitted to alternating signal processing stacks. The interrupted context (registers, signal mask, etc.) will be stored in the ucontext_t structure in the (possibly alternative) stack for the stream along with the trampoline return address. Signal handlers set with the SA_SIGINFO flag can examine this ucontext_t structure if they want, but the only portable thing they can do with it is to examine (and possibly change) the stored signal mask. (I’m not sure that its change is authorized by the standard, but it is very useful because it allows the signal processor to atomically replace the interrupted code signal mask upon return, for example, to leave the signal blocked so that it does not happen again.)
R .. Aug 04 2018-11-21T00: 00Z
source share