Commit 4b5ecfe0 authored by Denis Bilenko's avatar Denis Bilenko

use list, instead of set for Greenlet._links; this fixes issue #64

parent 2f231ce3
......@@ -138,7 +138,7 @@ class Greenlet(greenlet):
self.args = args
if kwargs:
self.kwargs = kwargs
self._links = set()
self._links = []
self.value = None
self._exception = _NONE
loop = self.parent.loop
......@@ -396,7 +396,7 @@ class Greenlet(greenlet):
"""
if not callable(callback):
raise TypeError('Expected callable: %r' % (callback, ))
self._links.add(callback)
self._links.append(callback)
if self.ready() and not self._notifier.active:
self._notifier.start(self._notify_links)
......@@ -438,7 +438,10 @@ class Greenlet(greenlet):
receiver = getcurrent()
# discarding greenlets when we have GreenletLink instances in _links works, because
# a GreenletLink instance pretends to be a greenlet, hash-wise and eq-wise
self._links.discard(receiver)
try:
self._links.remove(receiver)
except ValueError:
pass
def link_value(self, receiver=None, GreenletLink=SuccessGreenletLink, SpawnedLink=SuccessSpawnedLink):
"""Like :meth:`link` but *receiver* is only notified when the greenlet has completed successfully"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment