Not fully understanding the role of Queue.task_done()

Martin DeMello martindemello at
Thu Sep 4 22:59:16 CEST 2008

On Sep 4, 1:51 pm, Fredrik Lundh <fred... at> wrote:
> Martin DeMello wrote:
> > I'm writing a cluster monitor, that collects information from a set of
> > machines and logs it to a database
> > In the interests of not hammering the db unnecessarily, I'm
> > considering the following
> > 1. A series of independent "monitor" threads that collect information
> > over TCP from the cluster of machines, and write it to a queue
> > 2. A "logger" thread that empties the queue every second or so and
> > inserts the collected information to the db via a single insert
> > statement
> why are you using a queue for this case, btw?  why not just use a plain list
>      L = []
>      lock = threading.Lock()

Good point - I thought of queue because it was self-locking, but
you're right, I can as well use a simple list and lock it myself.


More information about the Python-list mailing list