summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-08-18 15:50:54 (GMT)
committerFred Drake <fdrake@acm.org>2000-08-18 15:50:54 (GMT)
commit7b4fc17c6d6f6ee802ca909ee646eaedeee8e2ac (patch)
tree34ea960ffd356e9156a3148b7e4914e701d01f61 /Lib
parentdef003845b687b785f70d655a5372906f7e042d2 (diff)
downloadcpython-7b4fc17c6d6f6ee802ca909ee646eaedeee8e2ac.zip
cpython-7b4fc17c6d6f6ee802ca909ee646eaedeee8e2ac.tar.gz
cpython-7b4fc17c6d6f6ee802ca909ee646eaedeee8e2ac.tar.bz2
Revise to use atexit instead of monkeying with sys.exitfunc directly.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/threading.py11
1 files changed, 2 insertions, 9 deletions
diff --git a/Lib/threading.py b/Lib/threading.py
index fb2eb21..4921f0e 100644
--- a/Lib/threading.py
+++ b/Lib/threading.py
@@ -462,11 +462,8 @@ class _MainThread(Thread):
_active_limbo_lock.acquire()
_active[_get_ident()] = self
_active_limbo_lock.release()
- try:
- self.__oldexitfunc = _sys.exitfunc
- except AttributeError:
- self.__oldexitfunc = None
- _sys.exitfunc = self.__exitfunc
+ import atexit
+ atexit.register(self.__exitfunc)
def _set_daemon(self):
return 0
@@ -480,10 +477,6 @@ class _MainThread(Thread):
while t:
t.join()
t = _pickSomeNonDaemonThread()
- if self.__oldexitfunc:
- if __debug__:
- self._note("%s: calling exit handler", self)
- self.__oldexitfunc()
if __debug__:
self._note("%s: exiting", self)
self._Thread__delete()