Created
September 15, 2015 21:15
-
-
Save avenet/193a6b409a69e0c8b6d9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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