Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 1126

Show
Ignore:
Timestamp:
06/07/06 01:07:09
Author:
fumanchu
Message:

Made Engine.stop check Engine.state. This allows e.g. mod_python to call stop() once per thread on shutdown.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/_cpengine.py

    r1125 r1126  
    104104    def stop(self): 
    105105        """Stop the application engine.""" 
    106         for thread_ident, i in self.seen_threads.iteritems(): 
    107             for func in self.on_stop_thread_list: 
    108                 func(i) 
    109         self.seen_threads.clear() 
    110          
    111         for func in self.on_stop_engine_list: 
    112             func() 
    113          
    114         self.state = STOPPED 
    115         cherrypy.log("CherryPy shut down", "ENGINE") 
     106        if self.state != STOPPED: 
     107            for thread_ident, i in self.seen_threads.iteritems(): 
     108                for func in self.on_stop_thread_list: 
     109                    func(i) 
     110            self.seen_threads.clear() 
     111             
     112            for func in self.on_stop_engine_list: 
     113                func() 
     114             
     115            self.state = STOPPED 
     116            cherrypy.log("CherryPy shut down", "ENGINE") 
    116117     
    117118    def restart(self): 

Hosted by WebFaction

Log in as guest/cpguest to create tickets