From cdf158a802e7e1cf5e6313650975e493df8ee965 Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Wed, 9 Jun 2010 20:01:27 +0100 Subject: [PATCH] Remove locking._CountingCondition This class is unused and untested. We must have forgot it around. Signed-off-by: Guido Trotter <ultrotter@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- lib/locking.py | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) diff --git a/lib/locking.py b/lib/locking.py index 28e640ff0..e7e16ebad 100644 --- a/lib/locking.py +++ b/lib/locking.py @@ -384,54 +384,6 @@ class PipeCondition(_BaseCondition): return bool(self._nwaiters) -class _CountingCondition(object): - """Wrapper for Python's built-in threading.Condition class. - - This wrapper keeps a count of active waiters. We can't access the internal - "__waiters" attribute of threading.Condition because it's not thread-safe. - - """ - __slots__ = [ - "_cond", - "_nwaiters", - ] - - def __init__(self, lock): - """Initializes this class. - - """ - object.__init__(self) - self._cond = threading.Condition(lock=lock) - self._nwaiters = 0 - - def notifyAll(self): # pylint: disable-msg=C0103 - """Notifies the condition. - - """ - return self._cond.notifyAll() - - def wait(self, timeout=None): - """Waits for the condition to be notified. - - @type timeout: float or None - @param timeout: Waiting timeout (can be None) - - """ - assert self._nwaiters >= 0 - - self._nwaiters += 1 - try: - return self._cond.wait(timeout=timeout) - finally: - self._nwaiters -= 1 - - def has_waiting(self): - """Returns whether there are active waiters. - - """ - return bool(self._nwaiters) - - class SharedLock(object): """Implements a shared lock. -- GitLab