简体   繁体   English

进程之间进行通信:Python多处理

[英]Communicating between Processes: Python Multiprocessing

I am using PyQt to create the gui for my application and ran into some trouble using threads for seperate processes, so started to use the multiprocessing.Process class. 我正在使用PyQt为我的应用程序创建gui,并且在使用线程处理独立进程时遇到了一些麻烦,因此开始使用multiprocessing.Process类。 I was, before, using Signals and slots to communicate between the worker process and the gui, but the SignalInstance class can not be pickled and as far as I know cant be used with Process so I am having to find another way to send a progress report (percent done etc) from the worker process to update a progress bar in the gui. 以前,我曾使用Signals和slot在worker进程和gui之间进行通信,但是我无法腌制SignalInstance类,并且据我所知,它不能与Process一起使用,因此我不得不寻找另一种发送进度的方法报告(完成百分比等),以更新gui中的进度条。 what is the best way of doing this? 最好的方法是什么?

Please see this answer, you can share memory between processes using the multiprocessing library. 请参阅答案,您可以使用多处理库在进程之间共享内存。 Documentation here (see 16.6.1.4. Sharing state between processes). 这里的文档(请参见16.6.1.4。进程之间的共享状态)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM