[Twisted-Python] Twisted-Python Digest, Vol 90, Issue 16
fabian.rothfuchs at googlemail.com
Mon Sep 19 15:40:04 EDT 2011
That¹s a tremendous advice!
Indeed I was directly calling connectTCP() - I changed it to do like
reactor.callFromThread(reactor.connectTCP, host, port, factory, timeout=5)
From: Glyph Lefkowitz <glyph at twistedmatrix.com>
Reply-To: Twisted general discussion <twisted-python at twistedmatrix.com>
Date: Mon, 19 Sep 2011 15:21:34 -0400
To: Twisted general discussion <twisted-python at twistedmatrix.com>
Subject: Re: [Twisted-Python] Twisted-Python Digest, Vol 90, Issue 16
On Sep 19, 2011, at 3:02 PM, Fabian Rothfuchs wrote:
> Well no, not from multiple threads.
> I have only two threads one main thread, which is the Django framework, and
> one detached
> thread for the reactor, as the reactor itself would be blocking Django.
> All Adapters are in Django, and are reaching out to the one reactor in the
> thread without threading themselves.
> Is this 'allowed' ?
I guess I should have said "supported", since clearly Python allows it :).
This is fine - depending very heavily what you mean by "reaching out to the
one reactor". Are they doing this reaching out via callFromThread (or
something that calls it, like blockingCallFromThread)? That is OK. Calling
reactor APIs (like connectTCP, or listenTCP, or callLater) from your Django
thread will break.
_______________________________________________ Twisted-Python mailing list
Twisted-Python at twistedmatrix.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Twisted-Python