Created
June 9, 2015 22:07
-
-
Save 1st1/4ee1d072309068dd2798 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 | |
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