Created
January 5, 2016 12:16
-
-
Save AeroNotix/5c5dc69b89a220ee9aff 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 foo1(): | |
while True: | |
print("foo1 running") | |
yield from asyncio.sleep(3) | |
@asyncio.coroutine | |
def foo2(): | |
asyncio.ensure_future(foo1()) | |
raise Exception("exception in foo2") | |
@asyncio.coroutine | |
def foo(): | |
asyncio.ensure_future(foo2()) | |
while True: | |
print("foo still running") | |
yield from asyncio.sleep(3) | |
asyncio.get_event_loop().run_until_complete(foo()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment