diff Lib/threading.py @ 44871:ffacb44673ea 2.5

Backport of r60190: - Fix Issue #1703448: A joined thread could show up in the threading.enumerate() list after the join() for a brief period until it actually exited.
author Gregory P. Smith <greg@mad-scientist.com>
date Tue, 22 Jan 2008 01:29:11 +0000
parents 2037f4cabb07
children 43fa50b9eb12
line wrap: on
line diff
--- a/Lib/threading.py	Mon Jan 21 23:35:11 2008 +0000
+++ b/Lib/threading.py	Tue Jan 22 01:29:11 2008 +0000
@@ -524,11 +524,17 @@
                 if __debug__:
                     self._note("%s.__bootstrap(): normal return", self)
         finally:
-            self.__stop()
+            _active_limbo_lock.acquire()
             try:
-                self.__delete()
-            except:
-                pass
+                self.__stop()
+                try:
+                    # We don't call self.__delete() because it also
+                    # grabs _active_limbo_lock.
+                    del _active[_get_ident()]
+                except:
+                    pass
+            finally:
+                _active_limbo_lock.release()
 
     def __stop(self):
         self.__block.acquire()