How to make a program exit?
Paul Rubin
phr-n2002a at nightsong.com
Wed Jan 2 07:54:40 EST 2002
What's the preferred way of making a multi-threaded program exit?
I have a SocketServer application using ThreadingMixin, i.e. a
multi-threaded socket listener.
I want the server to support a shutdown command, i.e. if a client
connects and sends a certain string, the whole server should shut
down gracefully.
In a non-threaded application I'd just call sys.exit(), but that
only collects the current listener thread rather than shutting down
the whole server.
I can think of some brutal ways to stop the server, but it's not clear
from the docs if there's a nice way.
Any advice? Thanks.
More information about the Python-list
mailing list