Killing subservient threads

jimzat jimzat at iname.com
Fri Feb 20 13:15:10 EST 2009


On Feb 20, 11:21 am, "Gabriel Genellina" <gagsl-... at yahoo.com.ar>
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)
>
> 2) catching an exception is as easy as enclosing the code in a try/except  
> block. And "commit suicide" is just "exit from the run() method".

Gabriel,

I am using the thread module and calling thread.start_new_thread
(...).  If I use t=thread.start_new_thread(...) and later set
t.terminate, I get "AttributeError: 'int' object has no attribute
'terminate'"

What is the proper way to do this?  I don't want to use globals as I
will have multiple child windows of various classes.





More information about the Python-list mailing list