[Twisted-Python] 1.3 patch for 0 delay
Bill la Forge
laforge49 at yahoo.co.in
Sat May 29 06:36:45 MDT 2004
Glyph,
Did you perchance do the regression test for that
patch I sent?
Bill la Forge
--- base.1.3.py 2004-05-21 08:08:58.000000000 +0530
+++ base.py 2004-05-22 10:50:10.015124800 +0530
@@ -368,10 +368,16 @@
assert callable(_f), "%s is not callable" %
_f
assert sys.maxint >= _seconds >= 0, \
"%s is not greater than or equal to 0
seconds" % (_seconds,)
- tple = DelayedCall(seconds() + _seconds, _f,
args, kw,
-
self._pendingTimedCalls.remove,
- self._resetCallLater)
- insort(self._pendingTimedCalls, tple)
+ if _seconds != 0:
+ tple = DelayedCall(_seconds + seconds(),
_f, args, kw,
+
self._pendingTimedCalls.remove,
+ self._resetCallLater)
+ insort(self._pendingTimedCalls, tple)
+ else:
+ tple = DelayedCall(0, _f, args, kw,
+
self._pendingTimedCalls.remove,
+ self._resetCallLater)
+ self._pendingTimedCalls.append(tple)
return tple
def _resetCallLater(self, tple):
@@ -415,9 +421,13 @@
log.err()
count += 1
del self.threadCallQueue[:count]
+ if not self._pendingTimedCalls:
+ return
now = seconds()
+ do=[]
while self._pendingTimedCalls and
(self._pendingTimedCalls[-1].time <= now):
- call = self._pendingTimedCalls.pop()
+ do.append(self._pendingTimedCalls.pop())
+ for call in do:
try:
call.called = 1
call.func(*call.args, **call.kw)
=====
Bill la Forge
http://www.geocities.com/laforge49/
________________________________________________________________________
Yahoo! India Matrimony: Find your partner online. http://yahoo.shaadi.com/india-matrimony/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: notes.txt
URL: </pipermail/twisted-python/attachments/20040529/48672ccc/attachment-0002.txt>
More information about the Twisted-Python
mailing list