开发者

python multi-processing queue: is putting independent from getting?

开发者 https://www.devze.com 2022-12-20 03:25 出处:网络
Is putting an object in a multi-processing queue independent from getting an object from it? In other words, will putting an object block the process P1 if another process P2 is getting from 开发者_运

Is putting an object in a multi-processing queue independent from getting an object from it?

In other words, will putting an object block the process P1 if another process P2 is getting from 开发者_运维技巧it?

Update: I am assuming an infinite queue.


My reading of the source code is that get obtains a read lock, which is independent of of the lock (called _notempty) acquired by put. If I understand correctly, concurrent gets can block each other, and concurrent puts can block each other (modulo your use of the block parameter), but that gets and puts do not mutually block.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号