equal
deleted
inserted
replaced
86 def _posixworker(ui, func, staticargs, args): |
86 def _posixworker(ui, func, staticargs, args): |
87 rfd, wfd = os.pipe() |
87 rfd, wfd = os.pipe() |
88 workers = _numworkers(ui) |
88 workers = _numworkers(ui) |
89 oldhandler = signal.getsignal(signal.SIGINT) |
89 oldhandler = signal.getsignal(signal.SIGINT) |
90 signal.signal(signal.SIGINT, signal.SIG_IGN) |
90 signal.signal(signal.SIGINT, signal.SIG_IGN) |
91 pids, problem = [], [0] |
91 pids, problem = set(), [0] |
92 def killworkers(): |
92 def killworkers(): |
93 # if one worker bails, there's no good reason to wait for the rest |
93 # if one worker bails, there's no good reason to wait for the rest |
94 for p in pids: |
94 for p in pids: |
95 try: |
95 try: |
96 os.kill(p, signal.SIGTERM) |
96 os.kill(p, signal.SIGTERM) |
116 os._exit(0) |
116 os._exit(0) |
117 except KeyboardInterrupt: |
117 except KeyboardInterrupt: |
118 os._exit(255) |
118 os._exit(255) |
119 # other exceptions are allowed to propagate, we rely |
119 # other exceptions are allowed to propagate, we rely |
120 # on lock.py's pid checks to avoid release callbacks |
120 # on lock.py's pid checks to avoid release callbacks |
121 pids.append(pid) |
121 pids.add(pid) |
122 pids.reverse() |
|
123 os.close(wfd) |
122 os.close(wfd) |
124 fp = os.fdopen(rfd, 'rb', 0) |
123 fp = os.fdopen(rfd, 'rb', 0) |
125 t = threading.Thread(target=waitforworkers) |
124 t = threading.Thread(target=waitforworkers) |
126 t.start() |
125 t.start() |
127 def cleanup(): |
126 def cleanup(): |