[Twisted-Python] thread synchronization

Jean-Paul Calderone exarkun at divmod.com
Sat Feb 3 13:19:22 EST 2007


On Sat, 3 Feb 2007 13:11:31 -0500, Lee Connell <lee.a.connell at gmail.com> wrote:
>While using Twisted, do I have to worry about locking objects to prevent
>multiple threads from accessing the object?  From what I’ve read Twisted
>doesn’t use a thread for each socket, so I would guess I don’t have to worry
>about thread locking?
>

Correct, Twisted does not use a thread for each socket.  In general, Twisted
will always only call code you have defined in a single thread, the reactor
thread.  So in general, no explicit locking is required.

Jean-Paul




More information about the Twisted-Python mailing list