[Twisted-Python] mutex in twisted?
p.mayers at imperial.ac.uk
Tue Mar 11 07:49:03 EDT 2008
Gabriel Rossetti wrote:
> Gabriel Rossetti wrote:
>> 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!
>> Twisted-Python mailing list
>> Twisted-Python at twistedmatrix.com
> 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
You need to use it.
You can use:
...if you want to just run a simple command
As for mutex - since Twisted isn't multithreaded, you can just use a
More information about the Twisted-Python