Processing asynchronous signals in multithreaded programs
The Linux programming interface book mentions a method of processing asynchronous signals in multithreaded programs:
The question now:
>When the kernel wants to pass a signal, it selects any thread of the process Where can I know to pass a signal to a dedicated thread? > Pthread API is a function of asynchronous security So how do we use them in signal handlers?
Solution
When the kernel provides a process - oriented signal, it selects a thread without signal blocking This means that it does not select any thread from the signal processing threads (it acts as if the blocked signal in sigwaitinfo () is unblocked) or similar signals In other words: the kernel knows where to send signals, because you have arranged such things that the signal processing thread is the only thread allowed to send signals
You do not use the pthreads API or any non asynchronous signal security features in the signal handler The solution outlined does not process signals in the signal handler – it processes signals in the normal execution flow of the signal processing thread after sigwaitinfo() returns This allows it to access non asynchronous signal security functions, which is the whole