[Python-ideas] channel (synchronous queue)
anacrolix at gmail.com
Sun Feb 19 01:39:16 CET 2012
Yes, channels can allow for this, but as with locks directionality and
ordering matter. Typically messages will only run in a particular
direction. Nor will all channels be synchronous (they're a tool, not a
panacea), they might be intermixed with infinite asynchronous queues as is
commonplace at the moment.
On Feb 19, 2012 8:19 AM, "Sturla Molden" <sturla at molden.no> wrote:
> 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.
> Python-ideas mailing list
> Python-ideas at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas