[Twisted-Python] callFromThread with return
Itamar Shtull-Trauring
itamar at itamarst.org
Wed Sep 17 08:50:00 EDT 2003
On Wed, 17 Sep 2003 12:58:29 +0400
Egor Cheshkov <egor at iplus.ru> wrote:
> Hello! Suppose I run task in worker thread (e.g. database transaction)
>
> and I need to do some IO (PB call) and get the result from it during
> transaction. Since I run not in reactor's thread it's ok to block and
> wait for the result. I know that there is callFromThread but it never
> return any result. Is it possible to implement something like
> callFromThread that can block, wait for result and return it?
As documented in the threading howto, you can use
twisted.internet.threads.deferToThread.
--
Itamar Shtull-Trauring http://itamarst.org/
Available for Python & Twisted consulting
More information about the Twisted-Python
mailing list