[Twisted-Python] IPushProducer - medium volume streaming

Rutt, Benjamin Benjamin.Rutt at gs.com
Sun Oct 28 09:42:00 EDT 2007

This isn't a SQL db so I can't use adbapi.

So using deferToThread, inside my thread, when I have a result to write
to the client, I call callFromThread to schedule a write in the reactor
loop.  My question is, how exactly do I use callFromThread to write to
the client from the thread (I use the LineReceiver class)?
(specifically, what context do I pass to the thread func, to pass into
callFromThread call, to make sure it writes back to the right client?)

-----Original Message-----
From: twisted-python-bounces at twistedmatrix.com
[mailto:twisted-python-bounces at twistedmatrix.com] On Behalf Of
Christopher Armstrong
Sent: Friday, October 26, 2007 7:19 PM
To: Twisted general discussion
Subject: Re: [Twisted-Python] IPushProducer - medium volume streaming

On 10/26/07, Rutt, Benjamin <Benjamin.Rutt at gs.com> wrote:
> 1) forking off a thread so that I will not block other clients from
> to the server.

If this is a SQL database with which you're using a dbapi module, you
should probably be using twisted.enterprise.adbapi to make access to
that database asynchronous. Under the hood it's using threads to make
the interface asynchronous. Otherwise, if the only programmatic
interface this database of yours has is blocking, then you'll probably
need to use a thread yourself. See

Christopher Armstrong
International Man of Twistery

Twisted-Python mailing list
Twisted-Python at twistedmatrix.com

More information about the Twisted-Python mailing list