mirror of
https://github.com/python/cpython.git
synced 2025-10-03 21:55:41 +00:00
Issue #15101: Make pool finalizer avoid joining current thread
This commit is contained in:
parent
48ee6908bc
commit
4215d2738a
2 changed files with 8 additions and 3 deletions
|
@ -489,7 +489,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(1e100)
|
||||||
|
|
||||||
# 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'):
|
||||||
|
@ -499,9 +500,11 @@ class Pool(object):
|
||||||
p.terminate()
|
p.terminate()
|
||||||
|
|
||||||
debug('joining task handler')
|
debug('joining task handler')
|
||||||
|
if threading.current_thread() is not task_handler:
|
||||||
task_handler.join(1e100)
|
task_handler.join(1e100)
|
||||||
|
|
||||||
debug('joining result handler')
|
debug('joining result handler')
|
||||||
|
if threading.current_thread() is not result_handler:
|
||||||
result_handler.join(1e100)
|
result_handler.join(1e100)
|
||||||
|
|
||||||
if pool and hasattr(pool[0], 'terminate'):
|
if pool and hasattr(pool[0], 'terminate'):
|
||||||
|
|
|
@ -67,6 +67,8 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #15101: Make pool finalizer avoid joining current thread.
|
||||||
|
|
||||||
- Issue #15054: A bug in tokenize.tokenize that caused string literals
|
- Issue #15054: A bug in tokenize.tokenize that caused string literals
|
||||||
with 'b' and 'br' prefixes to be incorrectly tokenized has been fixed.
|
with 'b' and 'br' prefixes to be incorrectly tokenized has been fixed.
|
||||||
Patch by Serhiy Storchaka.
|
Patch by Serhiy Storchaka.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue