質問

Let's assume that our process creates a child and then calls wait().

When I try to send signal() or do

kill -SIGCHLD <PID> 

nothing happens at all.

So the question is: How does the process in Linux determine that signal SIGCHLD hadn't been sent by the child? Or, maybe, there is some another mechanism?

役に立ちましたか?

解決

The kernel takes care of this.

wait() is not a signal handler listening for (any) SIGCHLD sent to a process, as it might be established via sigaction() or signal().

From wait()'s POSIX spec (emphasis by me):

The wait() and waitpid() functions shall obtain status information pertaining to one of the caller's child processes.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top