[issue14073] allow per-thread atexit()

Glenn Maynard report at bugs.python.org
Tue Nov 26 00:48:42 CET 2013


Glenn Maynard added the comment:

This would be useful.  It shouldn't be part of atexit, since atexit.register() from a thread should register a process-exit handler; instead, something like threading.(un)register_atexit().  If called in a thread, the calls happen when run() returns; if called in the main thread, call them when regular atexits are called (perhaps interleaved with atexit, as if atexit.register had been used).

For example, this can be helpful to handle cleaning up per-thread singletons like database connections.

----------
nosy: +Glenn.Maynard

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14073>
_______________________________________


More information about the Python-bugs-list mailing list