[Twisted-Python] Synchronization techniques
itamar at itamarst.org
Mon Apr 2 12:32:02 EDT 2007
> 1. Is reactor.iterate() meant to be used this way (see
> TwistedLock.acquire() and TwistedProcess.check_call())? If not, what
> is the right way to do those things? I've read everything I can find
> on reactor.iterate() and while it seems to be the only way to do what
> I need to do, its use is often strongly discouraged. Why is it so
> difficult for twisted to handle non-async code?
You should never call reactor.iterate().
> 2. Is my suspicion that the server could deadlock if I used
> threading.Lock correct?
Yes. And the Queue model uses threading.Lock, so using it can also
> 3. Is there a better way to do what I'm trying to do here? (getting a
> new accounting system is not an option :)
twisted.internet.defer.DeferredLock and some of the related classes are
what you ought to be using.
More information about the Twisted-Python