[Twisted-Python] Some suggestions

Glyph Lefkowitz glyph at twistedmatrix.com
Sat Aug 11 14:28:34 EDT 2001

On Sat, 11 Aug 2001, Itamar wrote:

> My main concern is *safety*. For example, I'm pretty sure making 
> connectionLose() synchronized is not enough to make it thread safe. 

Why not? If it's synchronized, and doWrite is synchronized, then I can't
figure out what the safety issue is.  Did you try, and experience some, or
do you know of some potential ones from reading it?

> Speed is good of course - and notice that synchronizing stuff slows
> down any non-threaded protocols I may be using along with my threaded
> one.

Yes.  Actually the simple statement 'import thread' will slow down
everything that your application does by approximately 5-20% (depending on
OS and #of CPUs mainly), even if you never start a thread.  That's why
there's all of that careful dancing around import statements when you look
at modules like threadable ;)

                      ______      __   __  _____  _     _
                     |  ____ |      \_/   |_____] |_____|
                     |_____| |_____  |    |       |     |
                     @ t w i s t e d m a t r i x  . c o m

More information about the Twisted-Python mailing list