[Twisted-Python] shared list in factory, mutexes?

Gabriel Rossetti mailing_lists at evotex.ch
Mon Apr 14 06:35:56 EDT 2008


Gabriel Rossetti wrote:
> Hello,
>
> I have to have a shared list in a server's factory to keep client 
> registration info. I had been using python's mutex class to make sure 
> only one registration at a time can be done. I just realized that this 
> is blocking and that's a no-no with twisted. My question is what would 
> be a better way of doing this?
>
> Gabriel
I'm wondering if maybe I'm misunderstanding something here, when several 
messages arrive, what happens, are they processed in parallel, are they 
put in a queue and processes sequentially? If I receive a message, do 
some heavy processing/io/potentially blocking code in a thread using 
twisted's threading module, and before it's done, I get another 
connection + message that needs the same thing to be done, what happens? 
If I'm going to receive a msg to be put in a queue, and another service 
that needed to retrieve the message from the queue, and I get several 
connections, wanting to access the queue, what happens? (This is a 
producer -consumer problem basically).

Thanks,
Gabriel




More information about the Twisted-Python mailing list