I am trying to run my sync functions using asyncio.run_in_executor
My coroutines shares data and update data. The run in executor starts threads. Do I need to make my objects thread and asyncio safe?
import asyncio from concurrent.futures import ThreadPoolExecutor class shared: #complex object def func(a, b): # blocking calls return a + b async def main(loop): result = await loop.run_in_executor(None, func, "Hello,", " world!") UpdateSharedObject(result) Start main as 5 tasks using create_task
Source: Python Questions