On 28/08/11 at 02:30 +0900, Motohiro KOSAKI wrote:
> 
> Issue #5239 has been updated by Motohiro KOSAKI.
> 
> Status changed from Open to Assigned
> Assignee set to Motohiro KOSAKI
> Target version set to 1.9.3
> 
> > The problem is that the call to $? in the thread cannot retrieve the exit value of the process started by popen. "$?" is 
> > transformed into a wait4() syscall, but wait4 is not allowed to inquire the state of non-child processes. And the popen
> > process is not a child of the sub-thread, it is a child of the main thread.
> >
> > http://pubs.opengroup.org/onlinepubs/009695399/functions/wait.html confirms that waitpid() is not supposed to work on
> > non-child processes.
> 
> In fact, it's a child process. see more below paragraph.
> 
> 
> > RATIONALE
> > A call to the wait() or waitpid() function only returns status on an immediate child process of the *calling process*
> 
> The pthread rule is, pthread_create() doen't introduce any process tree change. In the other words, kFreeBSD is buggy.

One could argue that a different PID makes a different process, but it's
correct that it's not a different process.

> But I'm planning to commit your patch because 1) it's only test case change and no impact to ruby code base 2) your patch
> doesn't introduce any ugliness.

Thanks

Lucas