Commit e783f8de authored by Denis Bilenko's avatar Denis Bilenko

gevent.wait(): fix leak of a timer

- test__greenlet.py: add TestJoinAll0
parent e9ef480b
......@@ -618,7 +618,8 @@ def iwait(objects, timeout=None):
waiter = Waiter()
switch = waiter.switch
if timeout is not None:
get_hub().loop.timer(timeout, priority=-1, ref=False).start(waiter.switch, _NONE)
timer = get_hub().loop.timer(timeout, priority=-1)
timer.start(waiter.switch, _NONE)
try:
count = len(objects)
for obj in objects:
......@@ -630,6 +631,8 @@ def iwait(objects, timeout=None):
return
yield item
finally:
if timeout is not None:
timer.stop()
for obj in objects:
obj.unlink(switch)
......
......@@ -433,6 +433,14 @@ class TestGet(greentest.GenericGetTestCase):
g.kill()
class TestJoinAll0(greentest.GenericWaitTestCase):
g = gevent.Greenlet()
def wait(self, timeout):
gevent.joinall([self.g], timeout=timeout)
class TestJoinAll(greentest.GenericWaitTestCase):
def wait(self, timeout):
......
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