On Sun, Jan 3, 2021 at 6:44 PM Abdulla Al Kathiri <[email protected]> wrote: > > I suppose asyncio.to_thread uses concurrent.futures.ThreadPoolExecutor under > the hood, so it saves us from getting the running event loop and calling the > loop.run_in_executor function . Why don’t we have a similar function for the > ProcessPoolExecutor, e.g. asyncio.to_process? >
asyncio.to_thread doesn't use ThreadPoolExecutor. Since thread is cheap, the function create a new thread every time. On the other hand, process is not cheap. That's why the only thread has convenient way to run function in. Regards, -- Inada Naoki <[email protected]> _______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/YPGAST223BKCD7GFIEYYOZ75ZXVYZNQX/ Code of Conduct: http://python.org/psf/codeofconduct/
