Remove green worker reference to its executor

There really is no need to give a green worker
a reference to its creator and it hinders/makes it
harder for python to garbage collect the executor
and its workers.

It is also not used, so let's make the python
garbage collectors life easier by not even passing
it in.

Change-Id: I0f9d27663c3ca5ca908ef6f90f3d1d0f6b5f9104
This commit is contained in:
Joshua Harlow 2015-09-23 17:44:41 -07:00
parent 7cfe013559
commit d537b59e45
1 changed files with 2 additions and 3 deletions

View File

@ -348,8 +348,7 @@ class SynchronousExecutor(_futures.Executor):
class _GreenWorker(object):
def __init__(self, executor, work, work_queue):
self.executor = executor
def __init__(self, work, work_queue):
self.work = work
self.work_queue = work_queue
@ -473,7 +472,7 @@ class GreenThreadPoolExecutor(_futures.Executor):
"""
alive = self._pool.running() + self._pool.waiting()
if alive < self._max_workers:
self._pool.spawn_n(_GreenWorker(self, work, self._delayed_work))
self._pool.spawn_n(_GreenWorker(work, self._delayed_work))
return True
return False