List Info

Thread: help with Tkinter, please




help with Tkinter, please
user name
2006-11-28 10:16:42
> > "The entire Python program exits when no
active non-daemon threads
> > are left."
>
> why do you recommend the use of daemons here?
> Wouldn't that just leave a load of silently running
daemon
> threads eating up resources after the main program
finishes?
> I don't see the logic of that one? I'd have thought you
wanted
> to be sure all application threads died when the app
died?
>
> What am I missing?


are you missing something?   i think
there is a distinction bewteen
a daemon/server process and daemon threads.  i don't think
that daemon
threads are spawned to a different process, save perhaps the
ones
started from C.

i believe that as soon as there are only daemon threads left
(a
complementary statement to the doc line above for Thread
objects), the
Python interpreter will exit, killing them all. i think
Python threads
are very similar to Java threads, but i'll let the thread
experts
chime in here.

in the meantime, i googled for some references and found
some good
(but perhaps long) reading:
http://www.quepublishing.com/arti
cles/article.asp?p=26044&seqNum=8&rl=1
http://groups.google.com/gr
oup/comp.lang.python/browse_thread/thread/3da7545c655bd769
http://groups.google.com/gr
oup/comp.lang.python/browse_thread/thread/e8551fad6e06421f
http://groups.google.com/gr
oup/comp.lang.python/browse_thread/thread/ffa4edeca2a4fd60
http://mail.python.org/pipermail/python-list/20
03-May/202288.html
http://groups.google.com/gr
oup/comp.lang.python/browse_thread/thread/8262b6e68481f1f9

hope this helps!
-- wes
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall,
(c)2007,2001
    http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulti
ng.com
_______________________________________________
Tutor maillist  -  Tutorpython.org
http://
mail.python.org/mailman/listinfo/tutor
help with Tkinter, please
user name
2006-11-28 11:10:21
wesley chun wrote:
>>> "The entire Python program exits when no
active non-daemon threads
>>> are left."
>> why do you recommend the use of daemons here?
>> Wouldn't that just leave a load of silently running
daemon
>> threads eating up resources after the main program
finishes?
>> I don't see the logic of that one? I'd have thought
you wanted
>> to be sure all application threads died when the
app died?
>>
>> What am I missing?
> 
> 
> are you missing something?   i think
there is a distinction bewteen
> a daemon/server process and daemon threads.  i don't
think that daemon
> threads are spawned to a different process, save
perhaps the ones
> started from C.
> 
> i believe that as soon as there are only daemon threads
left (a
> complementary statement to the doc line above for
Thread objects), the
> Python interpreter will exit, killing them all. i think
Python threads
> are very similar to Java threads, but i'll let the
thread experts
> chime in here.

Yes, that is correct. Daemon threads won't block the program
from 
exiting. They will be stopped when the program exits - they
are not 
separate processes.

However for the OP's application which is running
calculations in the 
background in a GUI application, the threads will probably
be created as 
needed and will end when the calculation is done. Unless the
calculation 
is long enough that you want to be able to exit the app
before the 
calculation completes, the thread doesn't really need to be
a daemon.

Kent

_______________________________________________
Tutor maillist  -  Tutorpython.org
http://
mail.python.org/mailman/listinfo/tutor
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )