Commit 36409a82 authored by Denis Bilenko's avatar Denis Bilenko

hub.Waiter: add __call__ (link protocol)

parent 1750f7aa
......@@ -411,6 +411,12 @@ class Waiter(object):
finally:
self.greenlet = None
def __call__(self, source):
if source.exception is None:
self.switch(source.value)
else:
self.throw(source.exception)
# can also have a debugging version, that wraps the value in a tuple (self, value) in switch()
# and unwraps it in wait() thus checking that switch() was indeed called
......
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