Threading modeule and condition??

Ishwar Rattan rattan at
Fri Jul 23 21:33:01 CEST 2004

System is Mandrake-9.1 with Python-2.3.4

I need to learn condition variables (mentioned in Section 7.5.3 of library
reference) but I am confused on the way of creating one. The documentation
# Produce one item

To choose between notify() and notifyAll(), consider whether one state
change can be interesting for only one or several waiting threads. E.g. in
a typical producer-consumer situation, adding one item to the buffer only
needs to wake up one consumer thread. 

class Condition([lock])

      If the lock argument is given and not None, it must be a Lock or RLock
object, and it is used as the underlying lock. Otherwise, a new RLock object
is created and used as the underlying lock. 

how do I insttantiate 'cv' the condition object in the first place. A code
fragment will be helpful.


More information about the Python-list mailing list