Killing subservient threads
gagsl-py2 at yahoo.com.ar
Sat Feb 21 05:17:41 CET 2009
En Fri, 20 Feb 2009 16:15:10 -0200, jimzat <jimzat at iname.com> escribió:
> 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
Use the threading module instead, that provides a higher level interface.
If you originally had:
then it becomes:
polling_thread = threading.Thread(target=function, args=args)
> 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.
Use an attribute of this Thread instance. Either a simple boolean or a
Condition/Event object as Christian Heimes suggested.
More information about the Python-list