[ksh93-integration-discuss] Re: Re: Shouldksh93/libshelluse|posix_spawn()| instead of |vfork()| ?
Roger A. Faulkner
Roger.Faulkner at Sun.COM
Wed Nov 1 15:31:05 PST 2006
>
> thanks for the analysis
>
> so it would be bad behavior to block all threads in
> the parent
> until the vfork() returns?
>
> doesn't a single threaded parent process block until
> vfork()
> returns anyway?
Actually, all threads in the parent are blocked until the
vforkd child calls exec() or exit().
The wait() race I referred to before occurs when the child
calls exit(). At that moment, all of the parent's threads
are made runnable and the other thread in wait() may
see the process before the posix_spawn() thread gets
to dispose of it. Of course, this is what obtains when the
posix_spawn() call succeeds, but when posix_spawn() fails
(returns non-zero), the Posix spec says that no child process
shall be created. The implementation actually creates a
child process when posix_spawn() fails with an error from
the child, but if the failing child can be made to disappear
completely then it is "as if" the child had never been created.
Roger Faulkner
Sun Microsystems
This message posted from opensolaris.org
More information about the ksh93-integration-discuss
mailing list