Skip to content

Commit 180a067

Browse files
committed
Rework to instead not put PID into pipe
1 parent 4ec18e8 commit 180a067

1 file changed

Lines changed: 0 additions & 13 deletions

File tree

‎Lib/concurrent/futures/process.py‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,6 @@ def _process_worker(call_queue, result_queue, initializer, initargs, max_tasks=N
249249
while True:
250250
call_item = call_queue.get(block=True)
251251
if call_item is None:
252-
# Wake up queue management thread
253-
result_queue.put(os.getpid())
254252
return
255253

256254
if max_tasks is not None:
@@ -531,9 +529,6 @@ def wait_result_broken_or_wakeup(self):
531529
return result_item, is_broken, cause
532530

533531
def process_result_item(self, result_item):
534-
# Process the received a result_item. This can be either the PID of a
535-
# worker that exited gracefully or a _ResultItem
536-
537532
# Received a _ResultItem so mark the future as completed.
538533
work_item = self.pending_work_items.pop(result_item.work_id, None)
539534
# work_item can be None if another process terminated (see above)
@@ -678,17 +673,9 @@ def _join_executor_internals(self, broken=False):
678673

679674
# If .join() is not called on the created processes then
680675
# some ctx.Queue methods may deadlock on Mac OS X.
681-
result_reader = self.result_queue._reader
682676
for p in self.processes.values():
683677
if broken:
684678
p.terminate()
685-
else:
686-
# Exiting workers put their pid on the result queue. Keep
687-
# draining it, otherwise once the pipe is full a worker
688-
# blocks forever writing to it and never exits.
689-
while p.sentinel not in mp.connection.wait(
690-
[result_reader, p.sentinel]):
691-
result_reader.recv_bytes()
692679
p.join()
693680

694681
def get_n_children_alive(self):

0 commit comments

Comments
 (0)