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
#!/Library/Frameworks/Python.framework/Versions/3.4/bin/python3 | |
""" | |
Synchronously call an asyncio task/coroutine from a non-asyncio thread. | |
usage: | |
# block the current thread until the coroutine yields or returns | |
value = sync_call(loop, coroutine, 1, 2, 3, four=4, five=5) | |
# control returns here when the coroutine is done | |
""" | |
import asyncio |