Commit 303e79a4 authored by Denis Bilenko's avatar Denis Bilenko

make the code compatible with python2.4

parent 9bb9f16c
...@@ -92,17 +92,18 @@ class GreenletSet(object): ...@@ -92,17 +92,18 @@ class GreenletSet(object):
def kill(self, exception=GreenletExit, block=True, timeout=None): def kill(self, exception=GreenletExit, block=True, timeout=None):
timer = Timeout.start_new(timeout) timer = Timeout.start_new(timeout)
try: try:
while self.greenlets: try:
for greenlet in list(self.greenlets): while self.greenlets:
if greenlet not in self.dying: for greenlet in list(self.greenlets):
greenlet.kill(exception, block=False) if greenlet not in self.dying:
self.dying.add(greenlet) greenlet.kill(exception, block=False)
if not block: self.dying.add(greenlet)
break if not block:
joinall(self.greenlets) break
except Timeout, ex: joinall(self.greenlets)
if ex is not timer: except Timeout, ex:
raise if ex is not timer:
raise
finally: finally:
timer.cancel() timer.cancel()
......
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