Author: dmeyer
Date: Sat Feb 18 12:49:51 2006
New Revision: 1192
Modified:
trunk/base/src/notifier/decorators.py
Log:
make timers weak to help the gc
Modified: trunk/base/src/notifier/decorators.py
==============================================================================
--- trunk/base/src/notifier/decorators.py (original)
+++ trunk/base/src/notifier/decorators.py Sat Feb 18 12:49:51 2006
@@ -34,6 +34,7 @@
# notifier thread imports
from thread import MainThreadCallback, is_mainthread
from jobserver import ThreadCallback
+from kaa.base import weakref
def execute_in_timer(timer, interval, type=''):
"""
@@ -73,7 +74,8 @@
obj = args[0]
name = '%s__%s' % (name, func.func_name)
# check current timer
- if hasattr(obj, name) and getattr(obj, name).active():
+ if hasattr(obj, name) and getattr(obj, name) and \
+ getattr(obj, name).active():
if type == 'once':
# timer already running and not override
return False
@@ -81,7 +83,8 @@
getattr(obj, name).stop()
# create new timer, set it to the object and start it
- setattr(obj, name, timer(func, *args, **kwargs))
+ t = timer(func, *args, **kwargs)
+ setattr(obj, name, weakref(t))
getattr(obj, name).start(interval)
return True
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog