Changeset 1305

Show
Ignore:
Timestamp:
06/06/09 14:12:14 (10 months ago)
Author:
mikeal
Message:

Adding thread2, killable threads library, and using them in the httpd server. Hopefully this will fix some of the zombie processes we see on Windows.

Location:
trunk
Files:
1 added
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/setup.py

    r1297 r1305  
    4242two_five_dependencies = [ 'simplejson >= 1.7.1', 
    4343                        ] 
    44 two_four_dependencies = ['uuid'] 
     44two_four_dependencies = ['uuid', 'ctypes'] 
    4545 
    4646if not sys.version.startswith('2.6'): 
  • trunk/windmill/server/https.py

    r1295 r1305  
    375375        HTTPServer.__init__(self, address, handler) 
    376376        self.setup_environ() 
     377        self.threads = [] 
    377378         
    378379    daemon_threads = True 
     
    422423        except socket.error: 
    423424            pass 
     425             
     426        for t in [t for t in self.threads if t.isAlive()]: 
     427            t.terminate() 
     428         
     429    def process_request(self, request, client_address): 
     430        """Start a new thread to process the request.""" 
     431        import thread2 
     432        t = thread2.Thread(target = self.process_request_thread, 
     433                           args = (request, client_address)) 
     434        if self.daemon_threads: 
     435            t.setDaemon (1) 
     436        t.start() 
     437        self.threads.append(t)     
    424438 
    425439    def handle_error(self, request, client_address):