wasm-demo/demo/ermis-f/python_m/cur/0270

53 lines
1.7 KiB
Plaintext

From: Jan.Kybic at epfl.ch (Jan Kybic)
Date: 28 Apr 1999 14:46:09 +0200
Subject: Q: Threading and reload
Message-ID: <lxkeml4oqum.fsf@ioasun3.epfl.ch>
Content-Length: 1535
X-UID: 270
Hello everybody,
I am developping a small web server. The problem is
that since I added multithreading, the reload() command does not seem
to have any effect. I have a separate thread for every request. The
interaction logic itself is in a special module. I would like to be
able to reload() this module for debugging purposes by issuing a
proper HTTP request. The code looks like this:
import Module
class ThreadingHTTPServer(BaseHTTPServer.HTTPServer):
def process_request(self, request, client_address):
"""Start a new thread to process the request."""
t=threading.Thread(target=self.finish_request,
args=(request, client_address))
t.setDaemon(1)
t.start()
class Handler(CGIHTTPServer.CGIHTTPRequestHandler):
def run_cgi(self):
if script=='reload':
reload(Module); ... ; return
...
if not clients.has_key[client_number]: # new client
clients[client_number]=Module.clientLogic()
clients[client_number].emit_page()
...
Before introducing threads, all worked fine but since then the reload()
does not seem to do anything. What am I doing wrong? Are there any
special considerations for using reload and threads? Thanks a lot.
Jan
--
-------------------------------------------------------------------------
Jan Kybic <Jan.Kybic at epfl.ch> BIG IOA DMT EPFL Lausanne, Switzerland
http://bigwww.epfl.ch/kybic tel. work +41 (21) 693 5741
For PGP key see my WWW page.