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.