[Twisted-Python] Lock class using Deferreds

exarkun at divmod.com exarkun at divmod.com
Fri Mar 5 17:21:00 MST 2004


On Fri, 05 Mar 2004 18:34:44 -0500, Christopher Armstrong <radix at twistedmatrix.com> wrote:
>Andrew Bennetts wrote:
> > On Fri, Mar 05, 2004 at 11:19:01AM -0500, Itamar Shtull-Trauring wrote:
> > 
> >>class Lock:
> >>    """A lock for event driven systems."""
> > 
> > 
> > I have very very similiar looking code on my harddisk... what inspired you
> > to write this? :)
> 
> I have something vaguely similar too; a class that handled a 'pipeline' 
> (?) of Deferreds and didn't allow more than N at a time. My purpose for 
> it was doing several thousand DNS queries and I only wanted at most N 
> outstanding requests at a time, so I wouldn't overload the servers. Ok, 
> so it's not that similar, but it's something that would probably go in 
> the same module ;-)

  Actually, it is extremely similar.  It's called a semaphore :)  This,
along with a condition class would probably all make for a good module.

  I was thinking twisted.python.defertools, if only defer wasn't part of
twisted.internet :(

  Jp





More information about the Twisted-Python mailing list