From: Michael V. DePalatis Date: Sat, 28 May 2016 17:37:48 +0000 (+0200) Subject: Make note on alternative IOLoops more general X-Git-Tag: v4.4.0b1~10^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1728%2Fhead;p=thirdparty%2Ftornado.git Make note on alternative IOLoops more general --- diff --git a/tornado/ioloop.py b/tornado/ioloop.py index 0bcbd7760..dcb90a165 100644 --- a/tornado/ioloop.py +++ b/tornado/ioloop.py @@ -172,6 +172,10 @@ class IOLoop(Configurable): This is normally not necessary as `instance()` will create an `IOLoop` on demand, but you may want to call `install` to use a custom subclass of `IOLoop`. + + When using an `IOLoop` subclass, `install` must be called prior + to creating any objects that implicitly create their own + `IOLoop` (e.g., :class:`tornado.httpclient.AsyncHTTPClient`). """ assert not IOLoop.initialized() IOLoop._instance = self diff --git a/tornado/platform/asyncio.py b/tornado/platform/asyncio.py index 9c3b3dfa5..3fd67dbd8 100644 --- a/tornado/platform/asyncio.py +++ b/tornado/platform/asyncio.py @@ -161,9 +161,8 @@ class AsyncIOMainLoop(BaseAsyncIOLoop): AsyncIOMainLoop().install() asyncio.get_event_loop().run_forever() - Note that the ``AsyncIOMainLoop`` must be installed prior to - creating any objects that implicitly create their own ``IOLoop`` - (e.g., :class:`tornado.httpclient.AsyncHTTPClient`). + See also :meth:`tornado.ioloop.IOLoop.install` for general notes on + installing alternative IOLoops. """ def initialize(self, **kwargs): super(AsyncIOMainLoop, self).initialize(asyncio.get_event_loop(), diff --git a/tornado/platform/twisted.py b/tornado/platform/twisted.py index 91a335832..653a79ffc 100644 --- a/tornado/platform/twisted.py +++ b/tornado/platform/twisted.py @@ -407,6 +407,9 @@ class TwistedIOLoop(tornado.ioloop.IOLoop): Not compatible with `tornado.process.Subprocess.set_exit_callback` because the ``SIGCHLD`` handlers used by Tornado and Twisted conflict with each other. + + See also :meth:`tornado.ioloop.IOLoop.install` for general notes on + installing alternative IOLoops. """ def initialize(self, reactor=None, **kwargs): super(TwistedIOLoop, self).initialize(**kwargs)