facebook/tornado — pull request #497 by polymorphm (2012-04-20 22:23:19+00:00)
Title: tornado.ioloop.IOLoop.instance() needs be threadsafe

`tornado.ioloop.IOLoop.instance()` needs be threadsafe (for example -- using pattern "double-checked locking")

if `tornado.ioloop.IOLoop.instance()` will NOT be threadsafe, then next function will be NOT threadsafe too:

def my_other_thread_function_a():
tornado.ioloop.IOLoop.instance().add_callback(my_function_b)

so, despite the fact that `add_callback()` is threadsafe -- there is no simple way to use `add_callback()` from other thread

pattern "double-checked locking" -- will not reduce speed of access to instance