Mercurial > hg
changeset 30425:03f7aa2bd0e3
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.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 17 Nov 2016 20:57:09 +0900 |
parents | f2d13eb85198 |
children | 605e3b126d46 |
files | mercurial/worker.py |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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