Skip to content

Commit 6ded654

Browse files
committed
asyncio_slow: Add example for scheduling coro using Task.
1 parent 9317881 commit 6ded654

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

asyncio_slow/test_hello_world_bare.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#import asyncio
2+
import asyncio_slow as asyncio
3+
4+
@asyncio.coroutine
5+
def greet_every_two_seconds():
6+
while True:
7+
print('Hello World')
8+
yield from asyncio.sleep(2)
9+
10+
loop = asyncio.get_event_loop()
11+
asyncio.Task(greet_every_two_seconds())
12+
loop.run_forever()

0 commit comments

Comments
 (0)