[PATCH 2/2] Cygwin: fork: Remember child not before success.

Michael Haubenwallner michael.haubenwallner@ssi-schaefer.com
Thu May 2 10:12:00 GMT 2019

On 4/30/19 6:07 PM, Corinna Vinschen wrote:
> On Apr 30 09:09, Michael Haubenwallner wrote:
>> Do not remember the child before it was successfully initialized, or we
>> would need more sophisticated cleanup on child initialization failure,
>> like cleaning up the process table and suppressing SIGCHILD delivery
>> with multiple threads ("waitproc") involved.
>> ---
>>  winsup/cygwin/fork.cc | 33 ++++++++++++++++++---------------
>>  1 file changed, 18 insertions(+), 15 deletions(-)
>> [...]
>> +  yield (); /* For child.remember (), to perform async thread startup. */
> Is that really necessary?  What's that fixing and what effect does this
> have on the performance of the already very slow fork()?

Indeed, that's needless.  Testing around the original patch in this thread
did lead me to the idea that the "waitproc" cygthread is started using
QueueUserAPC and async_startup, being executed by WFMO in ch.sync, which
I've reduced to yield later on.  But apparently I've been wrong here and the
waitproc thread is started synchronously.  Performance wise, I found it
negligible, but admitted I didn't perform the full >24h build.

Patch updated.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Cygwin-fork-Remember-child-not-before-success.patch
Type: text/x-patch
Size: 2836 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20190502/980c9a4d/attachment.bin>

More information about the Cygwin-patches mailing list