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

This commit is contained in:
Richard Oudkerk 2012-06-18 15:54:57 +01:00
parent da7a6e7da0
commit f29ec4b0c8
2 changed files with 8 additions and 3 deletions

View File

@ -493,6 +493,7 @@ 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')
if threading.current_thread() is not worker_handler:
worker_handler.join() worker_handler.join()
# Terminate workers which haven't already finished. # Terminate workers which haven't already finished.
@ -503,9 +504,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() task_handler.join()
debug('joining result handler') debug('joining result handler')
if threading.current_thread() is not result_handler:
result_handler.join() result_handler.join()
if pool and hasattr(pool[0], 'terminate'): if pool and hasattr(pool[0], 'terminate'):

View File

@ -70,6 +70,8 @@ Core and Builtins
Library Library
------- -------
- Issue #15101: Make pool finalizer avoid joining current thread.
- Issue #15036: Mailbox no longer throws an error if a flush is done - Issue #15036: Mailbox no longer throws an error if a flush is done
between operations when removing or changing multiple items in mbox, between operations when removing or changing multiple items in mbox,
MMDF, or Babyl mailboxes. MMDF, or Babyl mailboxes.