[Python-checkins] cpython (merge 3.2 -> default): Issue #15101: Make pool finalizer avoid joining current thread.
richard.oudkerk
python-checkins at python.org
Mon Jun 18 17:08:40 CEST 2012
http://hg.python.org/cpython/rev/59e0a51c5fc3
changeset: 77508:59e0a51c5fc3
parent: 77505:18de5d7e1256
parent: 77507:e1cd1f430ff1
user: Richard Oudkerk <shibturn at gmail.com>
date: Mon Jun 18 16:02:49 2012 +0100
summary:
Issue #15101: Make pool finalizer avoid joining current thread.
files:
Lib/multiprocessing/pool.py | 9 ++++++---
Misc/NEWS | 2 ++
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/Lib/multiprocessing/pool.py b/Lib/multiprocessing/pool.py
--- a/Lib/multiprocessing/pool.py
+++ b/Lib/multiprocessing/pool.py
@@ -496,7 +496,8 @@
# We must wait for the worker handler to exit before terminating
# workers because we don't want workers to be restarted behind our back.
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.
if pool and hasattr(pool[0], 'terminate'):
@@ -506,10 +507,12 @@
p.terminate()
debug('joining task handler')
- task_handler.join()
+ if threading.current_thread() is not task_handler:
+ task_handler.join()
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'):
debug('joining pool workers')
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -29,6 +29,8 @@
Library
-------
+- Issue #15101: Make pool finalizer avoid joining current thread.
+
- Issue #14657: The frozen instance of importlib used for bootstrap is now
also the module imported as importlib._bootstrap.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list