Wait supports syscall instead of gens now

This commit is contained in:
Jan Pochyla 2016-05-17 15:16:59 +02:00 committed by Pavol Rusnak
parent 4fb5dd0421
commit 3a5d29848b
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
1 changed files with 5 additions and 2 deletions

View File

@ -82,7 +82,10 @@ class Wait():
self.callback = gen self.callback = gen
def _wait(self, gen): def _wait(self, gen):
result = yield from gen if isinstance(gen, type_gen):
result = yield from gen
else:
result = yield gen
self._finish(gen, result) self._finish(gen, result)
def _finish(self, gen, result): def _finish(self, gen, result):
@ -91,7 +94,7 @@ class Wait():
schedule(self.callback, (gen, result)) schedule(self.callback, (gen, result))
if self.exit_others: if self.exit_others:
for g in self.scheduled: for g in self.scheduled:
if g is not gen: if g is not gen and isinstance(g, type_gen):
unschedule(g) unschedule(g)
unblock(g) unblock(g)
g.close() g.close()