]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
asyncio: Delegate executor methods to asyncio loop 2224/head
authorBen Darnell <ben@bendarnell.com>
Sat, 23 Dec 2017 02:28:33 +0000 (21:28 -0500)
committerBen Darnell <ben@bendarnell.com>
Sat, 23 Dec 2017 02:52:53 +0000 (21:52 -0500)
Avoid creating a second default thread pool to be managed.

tornado/platform/asyncio.py

index 0e81277c5f9ac564de22854e06c77838d3802309..63937b22ef1698ab2680fc4412b7f1b0f868b022 100644 (file)
@@ -140,6 +140,12 @@ class BaseAsyncIOLoop(IOLoop):
 
     add_callback_from_signal = add_callback
 
+    def run_in_executor(self, executor, func, *args):
+        return self.asyncio_loop.run_in_executor(executor, func, *args)
+
+    def set_default_executor(self, executor):
+        return self.asyncio_loop.set_default_executor(executor)
+
 
 class AsyncIOMainLoop(BaseAsyncIOLoop):
     """``AsyncIOMainLoop`` creates an `.IOLoop` that corresponds to the