[Zodb-checkins] CVS: Zope/lib/python/ThreadedAsync - LoopCallback.py:1.4.4.4 __init__.py:1.4.4.1

Chris McDonough chrism@zope.com
Fri, 3 Jan 2003 01:35:36 -0500


Update of /cvs-repository/Zope/lib/python/ThreadedAsync
In directory cvs.zope.org:/tmp/cvs-serv28207

Modified Files:
      Tag: chrism-install-branch
	LoopCallback.py __init__.py 
Log Message:
Merging chrism-install-branch with HEAD (hopefully for one of the last
times).



=== Zope/lib/python/ThreadedAsync/LoopCallback.py 1.4.4.3 => 1.4.4.4 ===
--- Zope/lib/python/ThreadedAsync/LoopCallback.py:1.4.4.3	Sun Nov 24 18:50:34 2002
+++ Zope/lib/python/ThreadedAsync/LoopCallback.py	Fri Jan  3 01:35:33 2003
@@ -24,10 +24,6 @@
 register_loop_callback() to register interest.  When the mainloop
 thread calls loop(), each registered callback will be called with the
 socket map as its first argument.
-
-This module rebinds loop() in the asyncore module; i.e. once this
-module is imported, any client of the asyncore module will get
-ThreadedAsync.loop() when it calls asyncore.loop().
 """
 __version__ = '$Revision$'[11:-2]
 
@@ -150,11 +146,26 @@
         poll_fun(timeout, map)
     _stop_loop()
 
-# Woo hoo!
-asyncore.loop = loop
 
-# What the heck did we just do?
+# This module used to do something evil -- it rebound asyncore.loop to the
+# above loop() function.  What was evil about this is that if you added some
+# debugging to asyncore.loop, you'd spend 6 hours debugging why your debugging
+# code wasn't called!
 #
-# Well, the thing is, we want to work with other asyncore aware
-# code. In particular, we don't necessarily want to make someone
-# import this module just to start or loop.
+# Code should instead explicitly call ThreadedAsync.loop() instead of
+# asyncore.loop().  Most of ZODB has been fixed, but ripping this out may
+# break 3rd party code.  So we'll issue a warning and let it continue -- for
+# now.
+
+##def deprecated_loop(*args, **kws):
+##    import warnings
+##    warnings.warn("""\
+##ThreadedAsync.loop() called through sneaky asyncore.loop() rebinding.
+##You should change your code to call ThreadedAsync.loop() explicitly.""",
+##                  DeprecationWarning)
+##    loop(*args, **kws)
+
+##asyncore.loop = deprecated_loop
+
+# XXX Remove this once we've updated ZODB4 since they share this package
+asyncore.loop = loop


=== Zope/lib/python/ThreadedAsync/__init__.py 1.4 => 1.4.4.1 ===
--- Zope/lib/python/ThreadedAsync/__init__.py:1.4	Wed Aug 14 18:02:00 2002
+++ Zope/lib/python/ThreadedAsync/__init__.py	Fri Jan  3 01:35:33 2003
@@ -11,8 +11,10 @@
 # FOR A PARTICULAR PURPOSE
 #
 ##############################################################################
+"""Manage the asyncore mainloop in a multi-threaded app.
+
+$Id$
 """
-"""
-__version__='$Revision$'[11:-2]
 
-from LoopCallback import register_loop_callback
+from LoopCallback import register_loop_callback, loop
+