Skip to content

Instantly share code, notes, and snippets.

@AeroNotix
Created January 5, 2016 12:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AeroNotix/5c5dc69b89a220ee9aff to your computer and use it in GitHub Desktop.
Save AeroNotix/5c5dc69b89a220ee9aff to your computer and use it in GitHub Desktop.
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