Killing subservient threads

Aahz aahz at pythoncraft.com
Thu Mar 12 11:34:39 EDT 2009


In article <mailman.372.1235151060.11746.python-list at python.org>,
Christian Heimes  <lists at cheimes.de> wrote:
>Gabriel Genellina wrote:
>>
>> 1) make the child window set a flag in the thread (let's say,
>> t.terminate = True). And make the polling thread check the flag
>> periodically (you possibly already have a loop there - just break the
>> loop when you detect that self.terminate became true)
>
>threading.Condition() and threading.Event() are especially designed for
>the job. Please use them appropriately.

Personally, I prefer to just use Queue for everything.  See
http://pythoncraft.com/OSCON2001/index.html
for examples, including one with Tkinter.

Side note: because of the Subject: line, I have to mention a website for
those who haven't seen it (requires Flash enabled):
http://www.subservientchicken.com/
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"All problems in computer science can be solved by another level of     
indirection."  --Butler Lampson



More information about the Python-list mailing list