From f1b0c0efc3b8dd1fffb078de1902b86c3f6d1530 Mon Sep 17 00:00:00 2001 From: "Michael V. DePalatis" Date: Sat, 28 May 2016 19:37:48 +0200 Subject: [PATCH] Make note on alternative IOLoops more general --- tornado/ioloop.py | 4 ++++ tornado/platform/asyncio.py | 5 ++--- tornado/platform/twisted.py | 3 +++ 3 files changed, 9 insertions(+), 3 deletions(-) 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) -- 2.47.2