worker: discard waited pid by anyone who noticed it first
This makes sure all waited pids are removed before calling killworkers()
even if waitpid()-pids.discard() sequence is interrupted by another SIGCHLD.
--- a/mercurial/worker.py Thu Nov 17 21:08:58 2016 +0900
+++ b/mercurial/worker.py Thu Nov 17 20:57:09 2016 +0900
@@ -111,11 +111,14 @@
if e.errno == errno.EINTR:
continue
elif e.errno == errno.ECHILD:
- break # ignore ECHILD
+ # child would already be reaped, but pids yet been
+ # updated (maybe interrupted just after waitpid)
+ pids.discard(pid)
+ break
else:
raise
if p:
- pids.remove(p)
+ pids.discard(p)
st = _exitstatus(st)
if st and not problem[0]:
problem[0] = st