[Twisted-Python] Synchronized FileDescriptor is bad

Itamar twisted at itamarst.org
Thu Aug 16 18:49:41 EDT 2001


The fact that FileDescriptor is synchronized may lead people to think 
it's thread safe, and it's not (connectionLose not being thread safe 
even when syncrhonized isn't based not only on conjecture but on actual 
observed errors.)

I think no code should be synchronized in threaded mode unless you 
absolutely know that it will thereby be made thread safe. Otherwise, 
what's the point? It's the equivalent of wrong documentation, and it 
slows things down.

Since there is now a generic mechanism for running non-thread safe code 
from threads (the threadtask module), there is no problem with this.






More information about the Twisted-Python mailing list