Package ganeti :: Module locking :: Class PipeCondition
[hide private]
[frames] | no frames]

Class PipeCondition

source code


Group-only non-polling condition with counters.

This condition class uses pipes and poll, internally, to be able to wait for notification with a timeout, without resorting to polling. It is almost compatible with Python's threading.Condition, but only supports notifyAll and non-recursive locks. As an additional features it's able to report whether there are any waiting threads.

Nested Classes [hide private]
  _single_condition_class
Condition which can only be notified once.
Instance Methods [hide private]
 
__init__(self, lock)
Initializes this class.
source code
 
wait(self, timeout)
Wait for a notification.
source code
 
notifyAll(self)
Notify all currently waiting threads.
source code
 
get_waiting(self)
Returns a list of all waiting threads.
source code
 
has_waiting(self)
Returns whether there are active waiters.
source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, lock)
(Constructor)

source code 

Initializes this class.

Parameters:
  • lock - condition base lock
Overrides: object.__init__

wait(self, timeout)

source code 

Wait for a notification.

Parameters:
  • timeout (float or None) - Waiting timeout (can be None)