17 Sep
2003
17 Sep
'03
12:50 p.m.
On Wed, 17 Sep 2003 12:58:29 +0400 Egor Cheshkov <egor@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