Antoon Pardon <[EMAIL PROTECTED]> writes: > The problem is this doesn't work well if you have multiple producers. > One producer can be finished while the other is still putting values > on the queue.
Right, you'd wait for all the producers to finish, then finish the queue: for p in producer_threads: p.join() q.finish() > The solution I have been thinking on is the following. > > Add an open and close operation. Only threads that have the queue > open can access it. The open call should specify whether you > want to read or write to the queue or both. When all writers > have closed the queue and the queue is empty a q.get will > raise an exception. This may be done by putting a sentinel > on the queue when the last writer closed the queue. That's an idea, but why would readers need to open the queue? -- http://mail.python.org/mailman/listinfo/python-list