Skip to content

Instantly share code, notes, and snippets.

@1st1
Created June 9, 2015 22:07
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 1st1/4ee1d072309068dd2798 to your computer and use it in GitHub Desktop.
Save 1st1/4ee1d072309068dd2798 to your computer and use it in GitHub Desktop.
import asyncio
async def worker():
fut = asyncio.Future()
def setval():
print('setval')
fut.set_result(123)
print('setup')
loop.call_later(1.0, setval)
print(await fut)
async def test():
await worker()
loop = asyncio.get_event_loop()
loop.run_until_complete(test())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment