4 ms·
afaik sync can call async if the language allows you to make an executor/event-loop. e.g. with python's asyncio it'd be something like def sync_foo(): ta
by uryga 6y ago
afaik sync can call async if the language allows you to make an executor/event-loop. e.g. with python's asyncio it'd be something like
def sync_foo():
task = async_bar()
loop = asyncio.new_event_loop()
return loop.run_until_complete(task)
after all, unless the loop is built into the language (like JS), you need bootstrap the async code somehow