Hi.
I'm trying to combine information at Signal Concepts and pthread_kill.
What puzzles me a bit is what should happen when a signal send with phread_kill is blocked by the thread. What I gather from those documents, is that the behaviour should be as if the signal was sent using the kill function, that is, the signal should be delivered to any thread that does not block it, any threads waiting the signal, or be pending on the process until such thread appears. This is not very clear though, so I'm kind of worried that I'm missing something here.
I'd be keep to implement the former, as signal delivery design would be easier if 'pthread_kill' could forward any blocked signals to 'kill'. Anyone with some insight on proper interpretation of the standard on this part?
posix blocked signals and pthread_kill
-
- Member
- Posts: 63
- Joined: Fri May 01, 2015 2:23 am
- Libera.chat IRC: Hellbender
posix blocked signals and pthread_kill
Hellbender OS at github.
Re: posix blocked signals and pthread_kill
My understanding is that if a thread blocks a signal then when that signal is sent to the thread it will be blocked. If the signal is sent to the process then the kernel will look for any thread that has that signal not blocked.
If a trainstation is where trains stop, what is a workstation ?
-
- Member
- Posts: 63
- Joined: Fri May 01, 2015 2:23 am
- Libera.chat IRC: Hellbender
Re: posix blocked signals and pthread_kill
gerryg400, although I might not like it, I tend to agree. It would be clear if these italic parts to the specs:
Also, the next statement is clear that multiple threads are considered when signal is generated for the process, implicitly excluding the signals generated for a thread:If the action associated with a blocked signal is anything other than to ignore the signal, and if that signal is generated for the thread, the signal shall remain pending until it is unblocked by the thread, it is accepted when it is selected and returned by a call to the sigwait() function by the thread, or the action associated with it is set to ignore the signal.
Damn. This means that I need pending signal queues for a process and each thread separately, and need to check both queues to see which signal should be delivered next. Another layer of added complexity..Signals generated for the process shall be delivered to exactly one of those threads within the process which is in a call to a sigwait() function selecting that signal or has not blocked delivery of the signal.
Hellbender OS at github.