[PATCH 8 of 8 V4] worker: stop using a separate thread waiting for children

Jun Wu quark at fb.com
Fri Nov 11 22:11:39 EST 2016


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1478919967 0
#      Sat Nov 12 03:06:07 2016 +0000
# Node ID 4474b3b508cb504f8132fad3450c94c90c3e5e6d
# Parent  7492186538a69cdfad28cb93093d7f7077942ca3
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 4474b3b508cb
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
@@ -12,5 +12,4 @@ import os
 import signal
 import sys
-import threading
 
 from .i18n import _
@@ -146,9 +145,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]


More information about the Mercurial-devel mailing list