[Twisted-Python] Two main loops

Bernie Roehl broehl at gmail.com
Sun Nov 11 09:03:35 EST 2007

I've got a 3D game that I've implemented in Python using an existing
game engine.  The engine "owns" the main loop, i.e. I call
engine.run() and it makes callbacks to my application on every frame
(and other game event).

Now I'm adding networking, and I'd like to use Twisted.  However,
Twisted uses the same approach as the game engine -- I call
reactor.run() and it makes callbacks to my application.

So, how do I integrate the two?

My first though is to call reactor.run() in a separate thread, but of
course that adds additional complexity in terms of synchronization.

I notice the docs mention reactor.iterate(), which appears to be
designed for exactly what I'm doing.  However, it's not clear how to
use it, and the method appears to be deprecated.

Any suggestions are appreciated...

   Bernie Roehl
   Mail: broehl at gmail.com

More information about the Twisted-Python mailing list