[Twisted-Python] callFromThread with return

Itamar Shtull-Trauring itamar at itamarst.org
Mon Oct 6 22:30:06 EDT 2003


On Tue, 7 Oct 2003 12:23:18 +1000
Andrew Bennetts <andrew-twisted at puzzling.org> wrote:

>     q = Queue.Queue()
>     reactor.callFromThread(func, q, arg1, arg2)
>     result = q.get()
> 
> Especially seeing as the latter requires cluttering 'func' with
> details of how to get the result back (i.e. a call to q.put), when the
> solution I proposed in my previous email would make it transparent.

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.

-- 
Itamar Shtull-Trauring    http://itamarst.org/
Available for Python & Twisted consulting




More information about the Twisted-Python mailing list