Use of threading.Condition class

vonWedel at lfpt.rwth-aachen.de vonWedel at lfpt.rwth-aachen.de
Thu Jan 4 07:37:23 EST 2001


Hi,

I'm trying to pass data between threads A and B. A notifies B to produce 
something 
and now I want the reference to the produced instance back in thread A. 
The documentation for threading.Condition proposes something like

     # Consume one item
     cv.acquire()
     while not an_item_is_available():
         cv.wait()
     get_an_available_item()
     cv.release()

for the consumer side. I don't understand the while loop around
the cv.wait() statement -- wouldn't cv.wait() block anyway until 
cv.notify() has been called in the other thread?

Lars
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20010104/873e16cd/attachment.html>


More information about the Python-list mailing list