Re: two questions about thread

2006-01-16 Thread Bryan Olson
Kevin wrote: > The best way to do this is by using a flag or event that the child-threads > monitor each loop (or multiple times per loop if it's a long loop). If the > flag is set, they exit themselves. > > The parent thread only has to set the flag to cause the children to die. Doesn't work, b

Re: two questions about thread

2006-01-15 Thread Kevin
The best way to do this is by using a flag or event that the child-threads monitor each loop (or multiple times per loop if it's a long loop). If the flag is set, they exit themselves. The parent thread only has to set the flag to cause the children to die. Kevin. "Bryan Olson" <[EMAIL PROTECT

Re: two questions about thread

2006-01-14 Thread Bryan Olson
iclinux wrote: > a. how to exit the whole process in a thread? > b. when thread doing a infinite loops, how to terminate the process?: As others noted, the threading module offers Thread.setDaemon. As the doc says: "The entire Python program exits when no active non-daemon threads are left." Py

Re: two questions about thread

2006-01-14 Thread Diez B. Roggisch
iclinux wrote: > hi there, > > I'm new to python, and have two questions: > > a. how to exit the whole process in a thread? sys.exit() Works only if Thread.setDaemon(True) is invoked on all threads. > b. when thread doing a infinite loops, how to terminate the process?: > it seems that th

two questions about thread

2006-01-14 Thread iclinux
hi there, I'm new to python, and have two questions: a. how to exit the whole process in a thread? b. when thread doing a infinite loops, how to terminate the process?: it seems that the follow doesn't work, in my Windows XP: thread.start() thread.join() Regards --