[Twisted-Python] A problem with threads

Itamar Shtull-Trauring lists at itamarst.org
Thu Oct 11 08:04:25 EDT 2001

Threadpool should have a function that lets you run a function in a thread 
and have the result passed to a Deferred object's callbacks. The callback 
functions in the Deferred should be run in the a thread-safe way.

There two alternatives:

1) Run the callbacks in the main event loop thread, which means using 
twisted.internet.threadtask. This adds a dependency on twisted.internet for 

2) Have the user implement the thread-safety stuff themselves.

I think (1) is the best way, otherwise you end up having to do a lot of work 
everytime you use callbacks. But then there's the dependancy issue...

More information about the Twisted-Python mailing list