diff options
Diffstat (limited to 'Lib/threading.py')
-rw-r--r-- | Lib/threading.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Lib/threading.py b/Lib/threading.py index 7b07265670..bab3b42641 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -524,11 +524,17 @@ class Thread(_Verbose): 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() |