SF bug [#410708] Condition.wait() and KeyboardInterrupt.

http://sourceforge.net/tracker/?func=detail&aid=410708&group_id=5470&atid=105470
Added try/finally around Condition.wait() guts, so that the lock state gets
restored at the end no matter what happens.
This commit is contained in:
Tim Peters 2001-04-02 20:15:57 +00:00
parent f5bd684337
commit c951bf9128

View file

@ -185,6 +185,7 @@ def wait(self, timeout=None):
waiter.acquire()
self.__waiters.append(waiter)
saved_state = self._release_save()
try: # restore state no matter what (e.g., KeyboardInterrupt)
if timeout is None:
waiter.acquire()
if __debug__:
@ -209,6 +210,7 @@ def wait(self, timeout=None):
else:
if __debug__:
self._note("%s.wait(%s): got it", self, timeout)
finally:
self._acquire_restore(saved_state)
def notify(self, n=1):