Kaydet (Commit) 0f884273 authored tarafından Richard Oudkerk's avatar Richard Oudkerk

Issue #15101: Make pool finalizer avoid joining current thread.

...@@ -496,7 +496,8 @@ class Pool(object): ...@@ -496,7 +496,8 @@ class Pool(object):
# We must wait for the worker handler to exit before terminating # We must wait for the worker handler to exit before terminating
# workers because we don't want workers to be restarted behind our back. # workers because we don't want workers to be restarted behind our back.
debug('joining worker handler') debug('joining worker handler')
worker_handler.join() if threading.current_thread() is not worker_handler:
worker_handler.join()
# Terminate workers which haven't already finished. # Terminate workers which haven't already finished.
if pool and hasattr(pool[0], 'terminate'): if pool and hasattr(pool[0], 'terminate'):
...@@ -506,10 +507,12 @@ class Pool(object): ...@@ -506,10 +507,12 @@ class Pool(object):
p.terminate() p.terminate()
debug('joining task handler') debug('joining task handler')
task_handler.join() if threading.current_thread() is not task_handler:
task_handler.join()
debug('joining result handler') debug('joining result handler')
result_handler.join() if threading.current_thread() is not result_handler:
result_handler.join()
if pool and hasattr(pool[0], 'terminate'): if pool and hasattr(pool[0], 'terminate'):
debug('joining pool workers') debug('joining pool workers')
......
...@@ -29,6 +29,8 @@ Core and Builtins ...@@ -29,6 +29,8 @@ Core and Builtins
Library Library
------- -------
- Issue #15101: Make pool finalizer avoid joining current thread.
- Issue #14657: The frozen instance of importlib used for bootstrap is now - Issue #14657: The frozen instance of importlib used for bootstrap is now
also the module imported as importlib._bootstrap. also the module imported as importlib._bootstrap.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment