From patchwork Tue Nov 15 02:39:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [8, of, 8, V5] worker: stop using a separate thread waiting for children From: Jun Wu X-Patchwork-Id: 17582 Message-Id: <977775ff43115c001579.1479177551@x1c> To: Date: Tue, 15 Nov 2016 02:39:11 +0000 # HG changeset patch # User Jun Wu # Date 1478919967 0 # Sat Nov 12 03:06:07 2016 +0000 # Node ID 977775ff43115c001579973ef09581f102b1b842 # Parent 3a463b68088ed4721b0b0a33504143b7eff65ade # Available At https://bitbucket.org/quark-zju/hg-draft # hg pull https://bitbucket.org/quark-zju/hg-draft -r 977775ff4311 worker: stop using a separate thread waiting for children Now that we have a SIGCHLD hander, and it could get executed when waiting for I/O. It's no longer necessary to have a separated waitpid thread. So just remove it. diff --git a/mercurial/worker.py b/mercurial/worker.py --- a/mercurial/worker.py +++ b/mercurial/worker.py @@ -13,5 +13,4 @@ import os import signal import sys -import threading from .i18n import _ @@ -144,9 +143,7 @@ def _posixworker(ui, func, staticargs, a os.close(wfd) fp = os.fdopen(rfd, 'rb', 0) - t = threading.Thread(target=waitforworkers) - t.start() def cleanup(): signal.signal(signal.SIGINT, oldhandler) - t.join() + waitforworkers() signal.signal(signal.SIGCHLD, oldchldhandler) status = problem[0]