<DIV>I do hereby consigne all copyrights for this patch to Glyph, as required </DIV>
<DIV>by Twisted: <A href="http://www.twistedmatrix.com/developers/contributing">http://www.twistedmatrix.com/developers/contributing</A></DIV>
<DIV> </DIV>
<DIV>Appologies for not using diff, but I am not yet able to download the </DIV>
<DIV>cygwin package. (perhaps Sunday bandwidth here will be better!)</DIV>
<DIV> </DIV>
<DIV>The first part was developed by twisted:</DIV>
<DIV> </DIV>
<DIV> def callLater(self, _seconds, _f, *args, **kw):<BR> """See twisted.internet.interfaces.IReactorTime.callLater.<BR> """<BR> assert callable(_f), "%s is not callable" % _f<BR> assert sys.maxint >= _seconds >= 0, \<BR> "%s is not greater than or equal to 0 seconds" % (_seconds,)<BR># patch follows <BR># tple = DelayedCall(seconds() + _seconds, _f, args, kw,<BR> if _seconds != 0:<BR> ttc = _seconds + seconds()<BR>
else:<BR> ttc = _seconds<BR> tple = DelayedCall(ttc, _f, args, kw,<BR># end of patch <BR> self._pendingTimedCalls.remove,<BR> self._resetCallLater)<BR> insort(self._pendingTimedCalls, tple)<BR> return tple<BR></DIV>
<DIV>The second part is my contribution:</DIV>
<DIV> </DIV>
<DIV> def runUntilCurrent(self):<BR> """Run all pending timed calls.<BR> """<BR> if self.threadCallQueue:<BR> # Keep track of how many calls we actually make, as we're<BR> # making them, in case another call is added to the queue<BR> # while we're in this loop.<BR> count = 0<BR> for (f, a, kw) in self.threadCallQueue:<BR>
try:<BR> f(*a, **kw)<BR> except:<BR> log.err()<BR> count += 1<BR> del self.threadCallQueue[:count]<BR> now = seconds()<BR># patch follows<BR># while self._pendingTimedCalls and (self._pendingTimedCalls[-1].time <= now):<BR># call = self._pendingTimedCalls.pop()<BR> do=[]<BR> while
self._pendingTimedCalls and (self._pendingTimedCalls[-1].time <= now):<BR> do.append(self._pendingTimedCalls.pop())<BR> for call in do:<BR># end of patch<BR> try:<BR> call.called = 1<BR> call.func(*call.args, **call.kw)<BR> except:<BR> log.deferr()<BR> if hasattr(call,
"creator"):<BR> e = "\n"<BR> e += " C: previous exception occurred in " + \<BR> "a DelayedCall created here:\n"<BR> e += " C:"<BR> e += "".join(call.creator).rstrip().replace("\n","\n C:")<BR> e +=
"\n"<BR> log.msg(e)<BR></DIV>
<DIV>Sincerly,</DIV>
<DIV> </DIV><BR><BR>Bill la Forge<br>http://www.geocities.com/laforge49/<p><font face=arial size=-1>
<a href="http://in.rd.yahoo.com/specials/mailtg/*http://yahoo.shaadi.com/india-matrimony/" target="_blank">
<b>Yahoo! India Matrimony</a>:</b> Find your partner
<a href="http://in.rd.yahoo.com/specials/mailtg2/*http://yahoo.shaadi.com/india-matrimony/community.php" target="_blank">online</a>.</font>