Package coro :: Module _coro :: Class condition_variable
[hide private]
[frames] | no frames]

Class condition_variable

object --+
         |
        condition_variable

Condition variable.

This locking primitive provides a method to "trigger" an event for other threads.

Instance Methods [hide private]
 
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature
 
__len__(x)
len(x)
a new object with type S, a subtype of T
__new__(T, S, ...)
 
raise_all(...)
Raise an exception on all waiting threads.
 
wait(...)
Wait for the condition variable to be triggered.
 
wait_timeout(...)
Deprecated.
 
wake_all(...)
Wake all waiting threads.
 
wake_n(...)
Wake a specific number of threads.
 
wake_one(...)
Wake only 1 thread.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]
  _waiting
: A fifo of coroutine objects waiting for the lock.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(...)
(Constructor)

 
x.__init__(...) initializes x; see help(type(x)) for signature
Overrides: object.__init__

__new__(T, S, ...)

 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__

raise_all(...)

 
Raise an exception on all waiting threads.
Parameters:
  • the_exception - : The exception to raise on all waiting threads.

wait(...)

 
Wait for the condition variable to be triggered.
Returns:
Returns the arguments given to the wake call (defaults to the empty tuple).

wake_all(...)

 
Wake all waiting threads.
Parameters:
  • args - : The arguments to wake the thread with. Defaults to the empty tuple.

wake_n(...)

 
Wake a specific number of threads.
Parameters:
  • count - : The number of threads to wake up.
  • args - : The arguments to wake the thread with. Defaults to the empty tuple.
Returns:
Returns the total number of threads actually awoken.

wake_one(...)

 

Wake only 1 thread.

If there are no threads waiting, this does nothing.

Parameters:
  • args - : The arguments to wake the thread with. Defaults to the empty tuple.
Returns:
Returns True if a thread was awoken, False if not.

Instance Variable Details [hide private]

_waiting

: A fifo of coroutine objects waiting for the lock. (C only.)