How to kill a thread?

Antoon Pardon apardon at forel.vub.ac.be
Mon Jun 9 07:33:33 EDT 2008


On 2008-06-07, Rhamphoryncus <rhamph at gmail.com> wrote:
> On Jun 6, 12:44 pm, The Pythonista <n... at this.time> wrote:
>> It's always been my understanding that you can't forcibly kill a thread
>> in Python (at least not in a portable way).  The best you can do is
>> politely ask it to die, IIRC.
>
> Inherently, the best you can do in most languages is ask them politely
> to die.  Otherwise you'll leave locks and various other datastructures
> in an inconvenient state, which is too complex to handle correctly.
> The exception is certain functional languages, which aren't capable of
> having threads and complex state in the same sense.

Well it would of course depend on what is considered asking politely?

If one thread could cause an exception being thrown in an other thread,
would this be considered a polite way to ask? Would it be considered
an acceptable way?

-- 
Antoon Pardon



More information about the Python-list mailing list