Changeset 1434
- Timestamp:
- 11/18/06 12:44:48
- Files:
-
- trunk/cherrypy/_cpengine.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/_cpengine.py
r1383 r1434 33 33 34 34 35 class PerpetualTimer(threading._Timer): 36 37 def run(self): 38 while True: 39 self.finished.wait(self.interval) 40 if self.finished.isSet(): 41 return 42 self.function(*self.args, **self.kwargs) 43 44 35 45 class Engine(object): 36 46 """Application interface for (HTTP) servers, plus process controls.""" … … 72 82 freq = self.deadlock_poll_freq 73 83 if freq > 0: 74 self.monitor_thread = threading.Timer(freq, self.monitor) 84 self.monitor_thread = PerpetualTimer(freq, self.monitor) 85 self.monitor_thread.setName("CPEngine Monitor") 75 86 self.monitor_thread.start() 76 87 … … 163 174 if self.monitor_thread: 164 175 self.monitor_thread.cancel() 176 self.monitor_thread.join() 165 177 self.monitor_thread = None 166 178 … … 212 224 213 225 def monitor(self): 214 """Check timeout on all responses (starts a recurring Timer thread)."""226 """Check timeout on all responses.""" 215 227 if self.state == STARTED: 216 228 for req, resp in self.servings: 217 229 resp.check_timeout() 218 freq = self.deadlock_poll_freq219 self.monitor_thread = threading.Timer(freq, self.monitor)220 self.monitor_thread.start()221 230 222 231 def start_with_callback(self, func, args=None, kwargs=None):

