SocketServer, its offspring, and threads

Tim Roberts timr at probo.com
Wed May 28 03:36:40 EDT 2008


eliben <eliben at gmail.com> wrote:
>
>I ended up using an ugly hack to make it work for me. Since
>handle_request() only blocks until a request is received, the thread
>can be unblocked by sending it a real message. So to stop a server, I
>opened a XML-RPC client connection (using ServerProxy from xmlrpclib)
>and made a request. In the server thread, handle_process() returned
>and the thread could see the flag requesting it to stop.
>
>There must be a better way ! Any ideas ?

Well, maybe it is a matter of personal preference, but I don't see anything
wrong with this approach.  If a thread is blocked waiting for a command,
what's wrong with sending it a "please commit suicide" command?
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list