For example, if I use kill (a function in C library signal.h) to emit a SIGINT signal to a child, will the SIGCHLD signal from the child be caught before the kill function returns?
While the kill
syscall isn't interruptible (at least according to the man page), there's still at least two cases in which the SIGCHLD
handler could run before the function returns:
kill
syscall returns in your first thread.kill
from your libc. The signal handler could run in between the syscall returning to it, and it returning to your code.So if you want to make sure you don't get the SIGCHLD
until after kill
returns, then you need to use sigprocmask
to block it before the kill
until you're ready for it.