[Twisted-Python] Twisted-Python Digest, Vol 90, Issue 16

Fabian Rothfuchs fabian.rothfuchs at googlemail.com
Mon Sep 19 15:02:18 EDT 2011

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' ?


From:  Glyph Lefkowitz <glyph at twistedmatrix.com>
Reply-To:  Twisted general discussion <twisted-python at twistedmatrix.com>
Date:  Mon, 19 Sep 2011 14:16:56 -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 2:03 PM, Fabian Rothfuchs wrote:

> The second important part was the wakeUp() call, which apparently triggers
> the reactor
> To end all blocking tasks.

For the most part, you have got the right idea now, but this is a BIG
flashing red light for me.  wakeUp() shouldn't actually be a public method
at all; its _only_ use is as part of the implementation of 'callFromThread'.
You should never, ever call it, and if you do call it, it should appear to
do nothing at all.

Are you making use of the reactor from multiple threads?  This is not
allowed, and will break horribly, although it can sometimes (briefly) be
made to appear to work by calling wakeUp().

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20110919/c73e6603/attachment.htm 

More information about the Twisted-Python mailing list