diff options
Diffstat (limited to 'Lib/threading.py')
-rw-r--r-- | Lib/threading.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Lib/threading.py b/Lib/threading.py index c7c4478..66620a9 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -290,6 +290,7 @@ class Condition: waiter.acquire() self._waiters.append(waiter) saved_state = self._release_save() + gotit = False try: # restore state no matter what (e.g., KeyboardInterrupt) if timeout is None: waiter.acquire() @@ -299,14 +300,14 @@ class Condition: gotit = waiter.acquire(True, timeout) else: gotit = waiter.acquire(False) - if not gotit: - try: - self._waiters.remove(waiter) - except ValueError: - pass return gotit finally: self._acquire_restore(saved_state) + if not gotit: + try: + self._waiters.remove(waiter) + except ValueError: + pass def wait_for(self, predicate, timeout=None): """Wait until a condition evaluates to True. |