diff options
author | Richard Oudkerk <shibturn@gmail.com> | 2012-06-18 14:37:31 (GMT) |
---|---|---|
committer | Richard Oudkerk <shibturn@gmail.com> | 2012-06-18 14:37:31 (GMT) |
commit | 4215d2738a44be9eca09eb7b48c31ed805c8fb60 (patch) | |
tree | 556d7cf28c716d77c8495d62e020bb9154c12d83 /Lib | |
parent | 48ee6908bc2f925cc95fdeb8e50ee628a38ca3bf (diff) | |
download | cpython-4215d2738a44be9eca09eb7b48c31ed805c8fb60.zip cpython-4215d2738a44be9eca09eb7b48c31ed805c8fb60.tar.gz cpython-4215d2738a44be9eca09eb7b48c31ed805c8fb60.tar.bz2 |
Issue #15101: Make pool finalizer avoid joining current thread
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/multiprocessing/pool.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/multiprocessing/pool.py b/Lib/multiprocessing/pool.py index 170aa7f..00c904a 100644 --- a/Lib/multiprocessing/pool.py +++ b/Lib/multiprocessing/pool.py @@ -489,7 +489,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(1e100) # Terminate workers which haven't already finished. if pool and hasattr(pool[0], 'terminate'): @@ -499,10 +500,12 @@ class Pool(object): p.terminate() debug('joining task handler') - task_handler.join(1e100) + if threading.current_thread() is not task_handler: + task_handler.join(1e100) debug('joining result handler') - result_handler.join(1e100) + if threading.current_thread() is not result_handler: + result_handler.join(1e100) if pool and hasattr(pool[0], 'terminate'): debug('joining pool workers') |