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

Shane Hathaway shane@cvs.zope.org
Mon, 8 Apr 2002 16:17:42 -0400


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

Modified Files:
      Tag: Zope3-Server-Branch
	ServerChannelBase.py 
Log Message:
Protect against running multiple tasks at once.

=== Zope3/lib/python/Zope/Server/ServerChannelBase.py 1.1.2.5 => 1.1.2.6 ===
         *** For thread safety, this should only be called from the main
         (async) thread. ***"""
+        if self.running_tasks:
+            # Can't start while another task is running!
+            # Otherwise two threads would work on the queue at the same time.
+            raise RuntimeError, 'Already executing tasks'
         self.running_tasks = 1
         self.set_sync()
         self.server.addTask(task)