[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/twisted/asyncore_main_loop.py Merged from 3.2 branch:

Jim Fulton jim at zope.com
Sat Dec 24 11:42:15 EST 2005


Log message for revision 41021:
  Merged from 3.2 branch:
  
  ------------------------------------------------------------------------
    r40909 | jim | 2005-12-20 10:56:38 -0500 (Tue, 20 Dec 2005) | 3 lines
  
  Use thread, rather than threading to avoid spurious messages on exit.
    See comment in code.
  

Changed:
  U   Zope3/trunk/src/zope/app/twisted/asyncore_main_loop.py

-=-
Modified: Zope3/trunk/src/zope/app/twisted/asyncore_main_loop.py
===================================================================
--- Zope3/trunk/src/zope/app/twisted/asyncore_main_loop.py	2005-12-24 16:41:17 UTC (rev 41020)
+++ Zope3/trunk/src/zope/app/twisted/asyncore_main_loop.py	2005-12-24 16:42:15 UTC (rev 41021)
@@ -68,8 +68,16 @@
 
 import logging
 import sys
-import threading
 
+# We're using thread, rather than threading because there seem to be
+# some end-of-process cleanup problems with the threading module that
+# cause weird unhelpful messages to get written to standard error
+# intermittently when Python is exiting.  We'll leave the old threading
+# code around in case it's helpful later.
+
+## import threading 
+import thread
+
 import ThreadedAsync
 logger = logging.getLogger('ZEO.twisted')
 
@@ -97,11 +105,13 @@
             pass
     
 def run_in_thread(reactor):
-    thread = threading.Thread(
-        target=run,
-        args=(reactor, ),
-        )
-    thread.setDaemon(True)
-    thread.start()
+# see note above
+##     thread = threading.Thread(
+##         target=run,
+##         args=(reactor, ),
+##         )
+##     thread.setDaemon(True)
+##     thread.start()
+    thread.start_new_thread(run, (reactor, ))
 
         



More information about the Zope3-Checkins mailing list