[英]Why does multiprocessing.Queue have no task_done method
为什么Queue.Queue
有task_done
方法而multiprocessing.Queue
没有这种方法?
我认为您需要JoinableQueue 。
My guess would be: multithreading
module was implemented very early, multiprocessing
module came in 2.6 version. 我的猜测是:
multithreading
模块是在很早以前实现的, multiprocessing
模块是2.6版。
The queue design was slightly corrected for multiprocessing
and offers better flexibility than the multithreading
, because you can choose between Queue
, SimpleQueue
and JoinableQueue
depending on your use cases (speed vs reliability). 队列设计已针对
multiprocessing
进行了稍微校正,并且比multithreading
提供了更好的灵活性,因为您可以根据用例(速度与可靠性)在Queue
, SimpleQueue
和JoinableQueue
之间进行选择。
Now modifing multithreading
like this would have caused backwards incompatibility, since join
and task_done
methods would have to be removed. 现在像这样修改
multithreading
将导致向后不兼容,因为必须删除join
和task_done
方法。 Imagine the code needed to be refactored, new tests had to be written, API broken - for me clearly no benefits. 想象一下需要重构的代码,必须编写新的测试,破坏API,对我来说显然没有任何好处。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.