[Zope-Checkins] CVS: Zope3/lib/python/Zope/Server - TaskThreads.py:1.1.2.6

Shane Hathaway shane@digicool.com
Mon, 7 Jan 2002 10:32:46 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/Server
In directory cvs.zope.org:/tmp/cvs-serv30808

Modified Files:
      Tag: Zope-3x-branch
	TaskThreads.py 
Log Message:
Added optional timeout parameter to shutdown().


=== Zope3/lib/python/Zope/Server/TaskThreads.py 1.1.2.5 => 1.1.2.6 ===
                 traceback.print_exception(exc[0], exc[1], exc[2])
 
-    def shutdown(self, cancel_pending=1):
+    def shutdown(self, cancel_pending=1, timeout=5):
         self.setThreadCount(0)
         # Ensure the threads shut down.
         threads = self.threads
-        timeout = time() + 5  # Up to 5 seconds.
+        expiration = time() + timeout
         while threads:
-            if time() > timeout:
-                self.error("%d zombie threads still exist" % len(threads))
+            if time() >= expiration:
+                self.error("%d thread(s) still running" % len(threads))
             sleep(0.1)
         if cancel_pending:
             # Cancel remaining tasks.