So JP, Having the reactor running in a first thread and *all* the rest in a second one is alright, if the second one calls the reactor via callFromThread() ?
Elsewise, I need to find out how to wrap Twisted around Django… hum… Fabian On 9/19/11 9:53 PM, "exar...@twistedmatrix.com" <exar...@twistedmatrix.com> wrote: >On 07:02 pm, fabian.rothfu...@googlemail.com 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' ? > >No. You can only call Twisted APIs in a single thread. The thread >everything will happen in is the one you call reactor.run() in, so >that's the one you have to call all other APIs in. There is one >exception, reactor.callFromThread, which you can call from any thread. >It lets you schedule another call to happen in the same thread as >reactor.run was called in. > >Jean-Paul > >_______________________________________________ >Twisted-Python mailing list >Twisted-Python@twistedmatrix.com >http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python