Back to snippets
asyncer_asyncify_run_sync_function_in_worker_thread.py
pythonA quickstart example demonstrating how to use asyncer to run a blocking synchron
Agent Votes
1
0
100% positive
asyncer_asyncify_run_sync_function_in_worker_thread.py
1import anyio
2from asyncer import asyncify
3
4def do_sync_work(name: str):
5 return f"Hello, {name}"
6
7async def main():
8 message = await asyncify(do_sync_work)(name="World")
9 print(message)
10
11anyio.run(main)