Merge "Cleanup thread on thread done callback"

This commit is contained in:
Jenkins 2015-10-06 05:29:00 +00:00 committed by Gerrit Code Review
commit 055fe76201
1 changed files with 5 additions and 5 deletions

View File

@ -24,13 +24,13 @@ from oslo_service import loopingcall
LOG = logging.getLogger(__name__)
def _thread_done(gt, *args, **kwargs):
def _on_thread_done(_greenthread, group, thread):
"""Callback function to be passed to GreenThread.link() when we spawn().
Calls the :class:`ThreadGroup` to notify if.
Calls the :class:`ThreadGroup` to notify it to remove this thread from
the associated group.
"""
kwargs['group'].thread_done(kwargs['thread'])
group.thread_done(thread)
class Thread(object):
@ -42,7 +42,7 @@ class Thread(object):
"""
def __init__(self, thread, group):
self.thread = thread
self.thread.link(_thread_done, group=group, thread=self)
self.thread.link(_on_thread_done, group, self)
self._ident = id(thread)
@property