kopia lustrzana https://github.com/micropython/micropython-lib
asyncio_slow: Add example for scheduling coro using Task.
rodzic
fdc3e21820
commit
ce54259e95
|
@ -0,0 +1,12 @@
|
|||
#import asyncio
|
||||
import asyncio_slow as asyncio
|
||||
|
||||
@asyncio.coroutine
|
||||
def greet_every_two_seconds():
|
||||
while True:
|
||||
print('Hello World')
|
||||
yield from asyncio.sleep(2)
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
asyncio.Task(greet_every_two_seconds())
|
||||
loop.run_forever()
|
Ładowanie…
Reference in New Issue