##// END OF EJS Templates
worker: make sure killworkers() never be interrupted by another SIGCHLD...
Yuya Nishihara -
r30423:237b2883 default
parent child Browse files
Show More
@@ -89,6 +89,10 def _posixworker(ui, func, staticargs, a
89 89 signal.signal(signal.SIGINT, signal.SIG_IGN)
90 90 pids, problem = set(), [0]
91 91 def killworkers():
92 # unregister SIGCHLD handler as all children will be killed. This
93 # function shouldn't be interrupted by another SIGCHLD; otherwise pids
94 # could be updated while iterating, which would cause inconsistency.
95 signal.signal(signal.SIGCHLD, oldchldhandler)
92 96 # if one worker bails, there's no good reason to wait for the rest
93 97 for p in pids:
94 98 try:
@@ -115,8 +119,6 def _posixworker(ui, func, staticargs, a
115 119 st = _exitstatus(st)
116 120 if st and not problem[0]:
117 121 problem[0] = st
118 # unregister SIGCHLD handler as all children will be killed
119 signal.signal(signal.SIGCHLD, oldchldhandler)
120 122 killworkers()
121 123 def sigchldhandler(signum, frame):
122 124 waitforworkers(blocking=False)
General Comments 0
You need to be logged in to leave comments. Login now