Thread-killing, round 666 (was Re: Lisp mentality vs. Python mentality)

Aahz aahz at pythoncraft.com
Sun Apr 26 11:28:02 EDT 2009


In article <a2c0da95-1f52-46f6-8a2e-253854080c5c at z23g2000prd.googlegroups.com>,
Vsevolod  <vseloved at gmail.com> wrote:
>
>And let's look at my recent experience with Python: I wanted to
>implement a daemon process and stumbled at a simplest problem with
>threading: neither Thread, nor Threading module provides thread-
>killing possibility. Surely, I'm not so experienced in Python as in
>Lisp (in which I'd definitely be able to solve this problem by
>extending the library), but I don't see an obvious solution, which
>will stay inside the language: I have to either use the shell or stick
>to the limited set of provided options and skew my program design to
>work with them. Any other suggestions?

The problem is that thread-killing (in the literal sense) doesn't work.
Unlike processes, there's no thread-environment encapsulation at the OS
level, which means that things don't get cleaned up properly.  Even Java
has mostly given up on thread-killing.  The only way to kill threads
safely is to have them terminate themselves.  Your other option is to use
multiple processes.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"If you think it's expensive to hire a professional to do the job, wait
until you hire an amateur."  --Red Adair



More information about the Python-list mailing list