Created
May 1, 2016 20:05
-
-
Save TigerND/9336f8cea8af8b6c7872966ff3788d64 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
@asyncio.coroutine | |
def slow_operation(n): | |
yield from asyncio.sleep(1) | |
print("Slow operation {} complete".format(n)) | |
@asyncio.coroutine | |
def main(): | |
yield from asyncio.wait([ | |
slow_operation(1), | |
slow_operation(2), | |
slow_operation(3), | |
]) | |
loop = asyncio.get_event_loop() | |
loop.run_until_complete(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment