kopia lustrzana https://github.com/micropython/micropython-lib
asyncio_slow: Add callback example from docs.
rodzic
6c419ad0ec
commit
d50091b802
|
@ -0,0 +1,11 @@
|
||||||
|
# https://docs.python.org/3.4/library/asyncio-eventloop.html#example-hello-world-callback
|
||||||
|
#import asyncio
|
||||||
|
import asyncio_slow as asyncio
|
||||||
|
|
||||||
|
def print_and_repeat(loop):
|
||||||
|
print('Hello World')
|
||||||
|
loop.call_later(2, print_and_repeat, loop)
|
||||||
|
|
||||||
|
loop = asyncio.get_event_loop()
|
||||||
|
loop.call_soon(print_and_repeat, loop)
|
||||||
|
loop.run_forever()
|
Ładowanie…
Reference in New Issue