[Python-ideas] channel (synchronous queue)
sturla at molden.no
Sun Feb 19 01:19:15 CET 2012
Den 18.02.2012 16:38, skrev Matt Joiner:
> Recently (for some) the CSP style of channel has become quite popular
> in concurrency implementations. This kind of channel allows sends that
> do not complete until a receiver has actually taken the item. The
> existing queue.Queue would act like this if it didn't treat a queue
> size of 0 as infinite capacity.
> In particular, I find channels to have value when sending data between
> threads, where it doesn't make sense to proceed until some current
> item has been accepted.
That is the most common cause of deadlock in number crunching code using
Process A sends message to Process B, waits for B to receive
Process B sends message to Process A, waits for A to receive
... and now we just wait ...
I am really glad the queues on Python do not do this.
More information about the Python-ideas