summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing
diff options
context:
space:
mode:
authorRichard Oudkerk <shibturn@gmail.com>2012-06-18 15:02:49 (GMT)
committerRichard Oudkerk <shibturn@gmail.com>2012-06-18 15:02:49 (GMT)
commit0f884273b0319272ca32d529af5c761d6dfa8a34 (patch)
tree9b7bbe899c3ea721a8666dc74bbcac859e43d409 /Lib/multiprocessing
parent13758848912933b99acb59261184a70fa6c7a5b4 (diff)
parentf29ec4b0c89bbb3a4ee4549b3b4a8535d040833f (diff)
downloadcpython-0f884273b0319272ca32d529af5c761d6dfa8a34.zip
cpython-0f884273b0319272ca32d529af5c761d6dfa8a34.tar.gz
cpython-0f884273b0319272ca32d529af5c761d6dfa8a34.tar.bz2
Issue #15101: Make pool finalizer avoid joining current thread.
Diffstat (limited to 'Lib/multiprocessing')
-rw-r--r--Lib/multiprocessing/pool.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/multiprocessing/pool.py b/Lib/multiprocessing/pool.py
index 7f5a7e3..59e547a 100644
--- a/Lib/multiprocessing/pool.py
+++ b/Lib/multiprocessing/pool.py
@@ -496,7 +496,8 @@ class Pool(object):
# 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 @@ class Pool(object):
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')