Re: at-exit-thread
- From: "Diez B. Roggisch" <deets@xxxxxxxxxxxxx>
- Date: Fri, 29 Feb 2008 20:55:07 +0100
castironpi@xxxxxxxxx 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
.
- Follow-Ups:
- Re: at-exit-thread
- From: castironpi
- Re: at-exit-thread
- References:
- at-exit-thread
- From: castironpi
- at-exit-thread
- Prev by Date: Re: joining strings question
- Next by Date: Re: at-exit-thread
- Previous by thread: at-exit-thread
- Next by thread: Re: at-exit-thread
- Index(es):
Relevant Pages
|