[Zodb-checkins] CVS: ZODB3/ThreadedAsync - __init__.py:1.6.18.1 LoopCallback.py:1.8.34.1

Jeremy Hylton jeremy at zope.com
Tue Sep 30 15:23:45 EDT 2003


Update of /cvs-repository/ZODB3/ThreadedAsync
In directory cvs.zope.org:/tmp/cvs-serv880/ThreadedAsync

Modified Files:
      Tag: Zope-2_7-branch
	__init__.py LoopCallback.py 
Log Message:
Add function to remove a callback.

This fix for leaks was first written for the zodb33-devel branch.


=== ZODB3/ThreadedAsync/__init__.py 1.6 => 1.6.18.1 ===
--- ZODB3/ThreadedAsync/__init__.py:1.6	Tue Feb 25 10:17:09 2003
+++ ZODB3/ThreadedAsync/__init__.py	Tue Sep 30 15:23:44 2003
@@ -16,4 +16,4 @@
 $Id$
 """
 
-from LoopCallback import register_loop_callback, loop
+from LoopCallback import register_loop_callback, loop, remove_loop_callback


=== ZODB3/ThreadedAsync/LoopCallback.py 1.8 => 1.8.34.1 ===
--- ZODB3/ThreadedAsync/LoopCallback.py:1.8	Thu Dec 12 16:15:42 2002
+++ ZODB3/ThreadedAsync/LoopCallback.py	Tue Sep 30 15:23:44 2003
@@ -57,7 +57,17 @@
             _loop_callbacks.append((callback, args, kw))
     finally:
         _loop_lock.release()
-
+        
+def remove_loop_callback(callback):
+    """Remove a callback function registered earlier.
+  	 
+    This is useful if loop() was never called.
+    """
+    for i in range(len(_loop_callbacks)):
+        if _loop_callbacks[i][0] == callback:
+            del _loop_callbacks[i]
+            return
+  	 
 def _start_loop(map):
     _loop_lock.acquire()
     try:




More information about the Zodb-checkins mailing list