Add _PipeCondition class
authorMichael Hanselmann <hansmi@google.com>
Mon, 28 Sep 2009 15:43:53 +0000 (17:43 +0200)
committerMichael Hanselmann <hansmi@google.com>
Wed, 30 Sep 2009 15:34:15 +0000 (17:34 +0200)
commit48dabc6ae13316c7ea99cd5382dc32e25f7d599c
tree5f532122cd8dbf00541ada6da065ad5b8159ae89
parentd76167a5931d30379fa038c2730bffe4b73df542
Add _PipeCondition class

_PipeCondition is a condition implemented using pipe(2) and poll(2).
It allows the implementation of timeouts without using a busy-wait loop
with time.sleep.

Unlike Python's built-in threading.Condition class and to save file
descriptors and an internal queue, it can only be used to notify
all waiters. Ganeti's use case for this condition class doesn't
require the ability to notify only one waiter.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
lib/locking.py
test/ganeti.locking_unittest.py