[Twisted-Python] Multiple thread pools

Moe Aboulkheir moe at divmod.com
Thu May 11 11:56:52 EDT 2006


On Thu, 11 May 2006 15:32:08 +0000 (GMT), Stéphane Brault <stephane_brault at yahoo.fr> wrote:
>Hi,
> I can see now how 'untwisted' my threads concerns are, please forget my newbie ununderstanding ;-)
> Still, I need to ensure that I won't have more than x similar calls at a time.
> Is there a way, maybe using some of the deferred classes (deferredqueue,..)
> to ensure that there is no more than x simultaneous similar calls (wrapped in deferreds), the others being pending,
> until one is finished

I think twisted.internet.defer.DeferredSemaphore is what you're looking for.  There is an example (someone else's example) of using it to do something similar here: http://pastebin.com/702986

Moe




More information about the Twisted-Python mailing list