PyDocs

Nav

Concurrent Execution

Condition

threading

class (source) not WASI
  • Condition(lock=None)
Class that implements a condition variable.

A condition variable allows one or more threads to wait until they are
notified by another thread.

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.
Changed in 3.3
  • 3.3: changed from a factory function to a class.
Members of Condition

a

acquire
Acquire the underlying lock.

l

locked
Return a boolean indicating whether this object is locked right now.

n

notify
Wake up one or more threads waiting on this condition, if any.
notify_all
Wake up all threads waiting on this condition.

r

release
Release the underlying lock.

w

wait
Wait until notified or until a timeout occurs.
wait_for
Wait until a condition evaluates to True.
0 Examples
No examples for threading/Condition.
See Also
No see-alsos for threading/Condition
0 Notes
No notes for Condition