[Twisted-Python] Multiple thread pools
    Stéphane Brault 
    stephane_brault at yahoo.fr
       
    Thu May 11 11:43:05 MDT 2006
    
    
  
Thanks Moe,
 the example seems to work, which is nice ;-)
 If I understand well DeferredSemaphore(x) guarantees that no more than x concurent calls that acquired it 
 will be run together. Am I wrong when inferring that DeferredList is not compulsory ? And that I adding calls to the semaphore
 as I need them will ensure the behaviour I want (as my tasks come, acquire the semaphore, then release it) ?
 
 Thaks again,
 
 Stéphane
----- Message d'origine ----
De : Moe Aboulkheir <moe at divmod.com>
À : twisted-python at twistedmatrix.com
Envoyé le : Jeudi, 11 Mai 2006, 5h56mn 52s
Objet : Re: Re : [Twisted-Python] Multiple thread pools
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
_______________________________________________
Twisted-Python mailing list
Twisted-Python at twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
    
    
More information about the Twisted-Python
mailing list