equal
deleted
inserted
replaced
4 # |
4 # |
5 # This software may be used and distributed according to the terms of the |
5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. |
6 # GNU General Public License version 2 or any later version. |
7 |
7 |
8 |
8 |
9 import errno |
|
10 import os |
9 import os |
11 import pickle |
10 import pickle |
12 import selectors |
11 import selectors |
13 import signal |
12 import signal |
14 import sys |
13 import sys |
175 signal.signal(signal.SIGCHLD, oldchldhandler) |
174 signal.signal(signal.SIGCHLD, oldchldhandler) |
176 # if one worker bails, there's no good reason to wait for the rest |
175 # if one worker bails, there's no good reason to wait for the rest |
177 for p in pids: |
176 for p in pids: |
178 try: |
177 try: |
179 os.kill(p, signal.SIGTERM) |
178 os.kill(p, signal.SIGTERM) |
180 except OSError as err: |
179 except ProcessLookupError: |
181 if err.errno != errno.ESRCH: |
180 pass |
182 raise |
|
183 |
181 |
184 def waitforworkers(blocking=True): |
182 def waitforworkers(blocking=True): |
185 for pid in pids.copy(): |
183 for pid in pids.copy(): |
186 p = st = 0 |
184 p = st = 0 |
187 try: |
185 try: |