[英]In Python, how can I send a Queue to a multiprocessing.Process after it has already been started?
Typically I do something like: 通常,我会执行以下操作:
q = Queue()
p = Process(target=f, args=(q,))
p.start()
Is there some way to pass p another Queue? 有什么方法可以传递另一个队列吗? Er... now that I think about it - can this be done through q?
嗯...现在我想到了-可以通过q完成吗?
q
. q
完成。 You can pass any object there, another Queue
included Queue
No, once a process has been created (the process is forked), queues can no longer be sent to it. 否,一旦创建了一个流程(该流程已分叉),就无法再向其发送队列。 They can only be sent at process creation time.
它们只能在流程创建时发送。 To do otherwise results in an exception.
否则会导致异常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.