fix for bug: cannot send an exception (tested by test__event.py)

This commit is contained in:
Denis Bilenko
2008-11-24 14:34:20 +06:00
parent 0e3ee4da23
commit 736197ca52

View File

@@ -214,7 +214,10 @@ class event(object):
self._exc = exc
hub = api.get_hub()
for waiter in self._waiters:
hub.schedule_call(0, waiter.switch, self._result)
if exc is None:
hub.schedule_call(0, waiter.switch, self._result)
else:
hub.schedule_call(0, waiter.throw, self._exc)
class semaphore(object):
"""Classic semaphore implemented with a counter and an event.