[Twisted-Python] callFromThread with return
andrew-twisted at puzzling.org
Mon Oct 6 22:39:00 EDT 2003
On Mon, Oct 06, 2003 at 10:30:06PM -0400, Itamar Shtull-Trauring wrote:
> t.i,threads should indeed have a utility function that does this for
> you. It would need to turn Failures into exceptions and deal
> transparently with Deferreds, of course.
I posted something like this to this thread earlier:
import threading, sys
from twisted.internet import reactor
e = threading.Event()
l = 
result, ok = l
# Whee! Cross-thread exceptions!
raise result, result, result
It doesn't deal with Failures or Deferreds, but it does everything else.
Oh, and it's not tested. If I had already written test cases, I probably
would've checked it in by now ;)
(And I'm sure there's a better name for it than 'blockingCallFromThread'...)
More information about the Twisted-Python