I'd generally recommend giving each main loop its own thread (with
appropriately synchronized handoffs between them), as this is the only
way to ensure that each loop is available to respond to its own events
as soon as they arrive instead of waiting for a periodic callback from
the other. If that's not an option for gmainloop, the simplest thing
to do is to call gmainloop.iterate() in a Tornado PeriodicCallback.
Tornado doesn't currently have an equivalent iteration method,
although you might be able to construct one by doing something like
def iterate(io_loop):
io_loop.add_callback(io_loop.stop)
io_loop.start()
-Ben