How to stop program when threads is sleeping

many_years_after shuanyu at gmail.com
Mon Dec 25 01:55:11 EST 2006


Hi, pythoners:

      There is a problem I couldn't dispose. I start a thread in the my
program. The thread will do something before executing time.sleep().
When the user give a signal to the main thread (such as click the 'end'
button or close the window), the thread should end it's running. But
how to end the threading when it's sleeping? I set an flag to the
thread, but it doesn't work.

      I also thought to put  'time.sleep()'   to the main thread. But I
think the main thread will not response to user's action because it is
executing sleep(). 

     Any ideas?
     Thanks.




More information about the Python-list mailing list