문제

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