kopia lustrzana https://github.com/micropython/micropython-lib
asyncio_slow: Fix wait: again, should not schedule anything itself.
rodzic
0b1d9a0493
commit
3949d4f8b6
|
@ -115,7 +115,7 @@ def async(coro):
|
||||||
return Task(coro)
|
return Task(coro)
|
||||||
|
|
||||||
|
|
||||||
class Wait(Future):
|
class _Wait(Future):
|
||||||
|
|
||||||
def __init__(self, n):
|
def __init__(self, n):
|
||||||
Future.__init__(self)
|
Future.__init__(self)
|
||||||
|
@ -133,12 +133,11 @@ class Wait(Future):
|
||||||
|
|
||||||
def wait(coro_list, loop=_def_event_loop):
|
def wait(coro_list, loop=_def_event_loop):
|
||||||
|
|
||||||
w = Wait(len(coro_list))
|
w = _Wait(len(coro_list))
|
||||||
|
|
||||||
for c in coro_list:
|
for c in coro_list:
|
||||||
t = async(c)
|
t = async(c)
|
||||||
t.add_done_callback(lambda val: w._done())
|
t.add_done_callback(lambda val: w._done())
|
||||||
loop.call_soon(t)
|
|
||||||
|
|
||||||
return w
|
return w
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue