at-exit-thread
Diez B. Roggisch
deets at nospam.web.de
Fri Feb 29 14:55:07 EST 2008
castironpi at gmail.com schrieb:
> The Python main interpreter has an at-exit list of callables, which
> are called when the interpreter exits. Can threads have one? What's
> involved, or is the best way merely to subclass Thread?
Is that some sort of trick-question?
class MyThread(Thread):
def run(self):
while some_condition:
do_something()
do_something_after_the_thread_ends()
The atexit stuff is for process-termination which is/may be induced by
external signals - which is the reason why these callbacks extist.
Threads don't have that, thus no need.
Diez
More information about the Python-list
mailing list