On Apr 18, 4:28 pm, a...@pythoncraft.com (Aahz) wrote: > Essentially, you use the Queue instead of the Condition. When you want > to explicitly give up control in a thread, you get() on the Queue until > you get an object (with the optional timeout). When the other thread is > done processing, it puts an object on the Queue (optionally doing a > get_nowait() at some point if it wants to make sure the Queue is cleaned > up).
Yep but as I said I have nothing to pass around > The critical advantage of using Queue is that you don't have to do the > acquire()/release() dance. And neither do I have to using the "with" statement ;) > It's not so much that there's an advantage to using Queue in this one > specific case as the fact that you can use Queue for almost everything > you'd use other kinds of locking mechanisms, so you can reduce your > mental model for dealing with threading. That surely helps not making synchronization errors, but I like fully understanding the concept even if it means being bitten by it! But thanks for your tips, they will surely be helpful in some other situation... -- http://mail.python.org/mailman/listinfo/python-list