[Twisted-Python] patch for background processing (delay 0)

Bill la Forge laforge49 at yahoo.co.in
Wed May 19 01:44:06 EDT 2004

Well, we're in the process of doing your third item, at least--making it two-phase.

Bob Ippolito <bob at redivi.com> wrote:
In my heapq implementation of a similar timer mechanism (outside of 
Twisted), I did three things that twisted doesn't:
- cancelling a timer doesn't try and remove it from the heapq, instead 
it just marks the timer as dead.
- the time when it's supposed to fire is passed to the fire method so 
that the timer can determine whether it's supposed to actually fire or 
not (in the case of a time change it is actually added to the queue a 
second time without being removed so that I don't have to disrupt the 
- it's two phase.. I have a list of newly added timers, and a heapq of 
waiting-to-fire timers. At the end of the iteration I shove the list 
into the heapq and clear the list. This prevents infinite callLater(0, 
...) situations.


Yahoo! India Matrimony: Find your partner online.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20040519/f9032141/attachment.htm 

More information about the Twisted-Python mailing list