[英]Does asyncio support running a subprocess from a non-main thread?
我正在开发一个主要由服务组成的应用程序,这些服务是具有自定义运行循环的线程。
其中一个服务需要产生子进程,我真的不明白它是否有效。 官方文件含糊不清。 即它表示asyncio supports running subprocesses from different threads
An event loop must run in the main thread
,并且An event loop must run in the main thread
在同一部分An event loop must run in the main thread
中An event loop must run in the main thread
。
如果事件循环必须在主线程中运行,那么甚至可以从不同的线程运行子进程?
文件说:
asyncio.get_child_watcher()
。 之后,您可以从非主线程创建子进程。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.