Prevent threading.Thread.join() from blocking when a previous call raised an

exception (e.g., passing in an illegal argument).

Applies patch #1314396.  Thanks Eric Blossom.
This commit is contained in:
Brett Cannon 2005-11-23 02:15:50 +00:00
parent 5c6e0a1a0c
commit ad07ff2c77
3 changed files with 23 additions and 16 deletions

View file

@ -536,6 +536,7 @@ class Thread(_Verbose):
if not self.__stopped: if not self.__stopped:
self._note("%s.join(): waiting until thread stops", self) self._note("%s.join(): waiting until thread stops", self)
self.__block.acquire() self.__block.acquire()
try:
if timeout is None: if timeout is None:
while not self.__stopped: while not self.__stopped:
self.__block.wait() self.__block.wait()
@ -553,6 +554,7 @@ class Thread(_Verbose):
else: else:
if __debug__: if __debug__:
self._note("%s.join(): thread stopped", self) self._note("%s.join(): thread stopped", self)
finally:
self.__block.release() self.__block.release()
def getName(self): def getName(self):

View file

@ -63,6 +63,7 @@ Roy Bixler
Martin Bless Martin Bless
Pablo Bleyer Pablo Bleyer
Erik van Blokland Erik van Blokland
Eric Blossom
Finn Bock Finn Bock
Paul Boddie Paul Boddie
Matthew Boedicker Matthew Boedicker

View file

@ -284,6 +284,10 @@ Extension Modules
Library Library
------- -------
- Patch #1314396: prevent deadlock for threading.Thread.join() when an exception
is raised within the method itself on a previous call (e.g., passing in an
illegal argument)
- Bug #1340337: change time.strptime() to always return ValueError when there - Bug #1340337: change time.strptime() to always return ValueError when there
is an error in the format string. is an error in the format string.