[Twisted-Python] mutex in twisted?

Gabriel Rossetti mailing_lists at evotex.ch
Tue Mar 11 09:15:47 EDT 2008

Phil Mayers wrote:
> Gabriel Rossetti wrote:
>> Gabriel Rossetti wrote:
>>> Hello,
>>> Is there some sort of mutex/semaphore code that can be used in 
>>> twisted? I need to run an external subprocess from twisted when I 
>>> get some data from a client and I'd like to make sure that while one 
>>> client's data spawned the process to run, some other client will not 
>>> do the same at the same time, thus my need for a mutex. Maybe there 
>>> is another way to do this in a more twisted sort of way (pun not 
>>> intended)? If so I'd love to hear how!
>>> Thanks,
>>> Gabriel
>>> _______________________________________________
>>> Twisted-Python mailing list
>>> Twisted-Python at twistedmatrix.com
>>> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>> Oh, I forgot to say, I use this for the process :
>> subprocess.call(["festival", "--tts", filename])
> You can't do that. The python "subprocess" module is blocking, and yuo 
> will block the reactor and stop Twisted running.
>> I'm not sure if it is useful for anyone, but I just saw that Twisted 
>> has some sort of process code too, though it looks a bit complicated 
>> for my needs.
> You need to use it.
> You can use:
> twisted.internet.utils.getProcessOutputAndValue
> ...if you want to just run a simple command
Ok, yes, that is all I need to do, run a simple command.
> As for mutex - since Twisted isn't multithreaded, you can just use a 
> flag variable.
Ok, cool, thanks a lot for your help,

More information about the Twisted-Python mailing list