Cleanly exiting multi thread application on SIGINT

skip at pobox.com skip at pobox.com
Fri Mar 23 09:02:02 EDT 2007


    Jon> Is the following the most elegant way to exit a multi-threaded
    Jon> application on a Ctrl-C?  I am a complete beginner and would have
    Jon> thought there was some way of doing it without having to use while
    Jon> 1: pass, but have yet to find a way.

I thought there was some sort of wait() method in the threading module, but
I was mistaken.  Maybe:

    while threading.activeCount():
        time.sleep(0.01)

?

Skip



More information about the Python-list mailing list