Speaking of my package Toro, I've just released version 0.5. Toro provides semaphores, queues, and so on, for advanced control flows with Tornado coroutines.
Version 0.5 is a rewrite, motivated by two recent events. First, the release of Tornado 3.0 has introduced a much more convenient coroutine API, and I wanted Toro to support the modern style. Second, I contributed a version of Toro's queues to Tulip, and the queues changed a bit in the process. As much as possible, I updated Toro to match the API of Tulip's locks and queues, for consistency's sake.
In previous versions, most Toro methods had to be wrapped in
gen.Task, which made for weird-looking code. But using Toro is now quite graceful. For example, a producer-consumer pair:
q = toro.Queue() @gen.coroutine def producer(): for item in range(5): print 'Sending', item yield q.put(item) @gen.coroutine def consumer(): while True: item = yield q.get() print '\t\t', 'Got', item consumer() producer() IOLoop.current().start()
Another nice new feature:
Lock.acquire can be used with the
lock = toro.Lock() @gen.coroutine def f(): with (yield lock.acquire()): print "We're in the lock" print "Out of the lock"
More examples are in the docs. Enjoy!