Re: [patch] Re: Problem with exiting threads under NPTL

Roland McGrath
2003-12-15T22:55:49Z

> On Sun, 2003-12-14 at 23:10, Linus Torvalds wrote:
>
> > Even though the parent ignores SIGCHLD it _can_ be running on another CPU
> > in "wait4()".
>
> which fwiw is a case of illegal behavior in the program ... of course
> the kernel shouldn't die if it happens.

No, it is legal to call wait* when ignoring SIGCHLD--and it is required to
return ECHILD for the dead ones. For example, using waitpid with WNOHANG
is a valid way to poll for the liveness of a child (though there is no good
reason why an application wouldn't just use kill(,0) for that). It's not a
method that has anything to recommend it, but it is perfectly valid and the
range of permissible results is well-specified.