/threadloop

Tornado IOLoop Backed Concurrent Futures

Primary LanguagePythonMIT LicenseMIT

ThreadLoop

build-status coverage pypi

Run Tornado Coroutines from Synchronous Python.
from threadloop import ThreadLoop
from tornado import gen

@gen.coroutine
def coroutine(greeting="Goodbye"):
    yield gen.sleep(1)
    raise gen.Return("%s World" % greeting)

with ThreadLoop() as threadloop:
    future = threadloop.submit(coroutine, "Hello")

    print future.result() # Hello World