Queue limitations?

Fredrik Lundh fredrik at pythonware.com
Thu Mar 16 08:40:20 CET 2006


mateom at gmail.com wrote:

> I should be able to add to the queue as fast as I want, right?

absolutely.

but if you slow the producer down, and you're only using one producer
and one consumer, the chance increases that the producer and the
consumer runs in perfect lockstep.  you might as well *call* the con-
sumer from the producer...

> I tried adding time.sleep(.05) right after put(image) in the producer,
> and that fixes it.  There is only one thread producing and one thread
> consuming.

are you sure that the producer is creating new images, rather than
just pushing out references to the same data buffer ?

the frombuffer operation you're using in the client creates an image
object based on data in an external object; it does not copy the pixel
data.  if the data in that buffer is changed by the producer, the image
seen by the consumer will change too.

</F>






More information about the Python-list mailing list