Skip to content

Commit 546ec80

Browse files
committed
Mark ProcessPoolExecutor shutdown from queue management thread if shutting down
1 parent 47e72fc commit 546ec80

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Lib/concurrent/futures/process.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,10 @@ def shutdown_worker():
421421
# - The executor that owns this worker has been shutdown.
422422
if shutting_down():
423423
try:
424+
# Flag the executor as shutting down as early as possible if it
425+
# is not gc-ed yet.
426+
if executor is not None:
427+
executor._shutdown_thread = True
424428
# Since no new work items can be added, it is safe to shutdown
425429
# this thread if there are no pending work items.
426430
if not pending_work_items:

0 commit comments

Comments
 (0)