##// 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 b' def _posixworker(ui, func, staticargs, a'
89 signal.signal(signal.SIGINT, signal.SIG_IGN)
89 signal.signal(signal.SIGINT, signal.SIG_IGN)
90 pids, problem = set(), [0]
90 pids, problem = set(), [0]
91 def killworkers():
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 # if one worker bails, there's no good reason to wait for the rest
96 # if one worker bails, there's no good reason to wait for the rest
93 for p in pids:
97 for p in pids:
94 try:
98 try:
@@ -115,8 +119,6 b' def _posixworker(ui, func, staticargs, a'
115 st = _exitstatus(st)
119 st = _exitstatus(st)
116 if st and not problem[0]:
120 if st and not problem[0]:
117 problem[0] = st
121 problem[0] = st
118 # unregister SIGCHLD handler as all children will be killed
119 signal.signal(signal.SIGCHLD, oldchldhandler)
120 killworkers()
122 killworkers()
121 def sigchldhandler(signum, frame):
123 def sigchldhandler(signum, frame):
122 waitforworkers(blocking=False)
124 waitforworkers(blocking=False)
General Comments 0
You need to be logged in to leave comments. Login now